Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use .htaccess for friendly url

I've read many of the similar questions but have not been able to alter the url to an SEO friendly name. It's bizarre because I believe my requirement should be simple. So I'm going to be specific in hopes of finding out what I'm missing. I'm doing my testing on a local machine before I put it up on the server.

Here's what I got:

http://localhost/ggs2/forms/mymain.php

Here's what I want

http://localhost/ggs2/goals

In the ggs2 subdirectory I have an .htaccess file that reads:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/goals$ /forms/mymain.php

When I click on the link to the target the URL has not been modified.

So:

  • Is there a problem with the .htaccess file?
  • Is there some server setting I need to set?
  • Something else?

Thanks

like image 633
user670874 Avatar asked Oct 28 '11 04:10

user670874


1 Answers

try this:

RewriteRule ^goals/?$ /forms/mymain.php [NC,L]

The first slash is removed, which means you were looking for the root folder, not the current folder.

like image 158
Book Of Zeus Avatar answered Sep 30 '22 21:09

Book Of Zeus