user670874
user670874

Reputation: 131

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:

Thanks

Upvotes: 6

Views: 243

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49877

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.

Upvotes: 11

Related Questions