user2570937
user2570937

Reputation: 852

htaccess rewrite rule not rewriting correctly

I'm trying to change this:

http://example.com/profile.php?name=john

to

http://example.com/john

However it isn't working. It's displaying profile.php as my GET. Any ideas?

RewriteRule ^([^-]*)$ profile.php?name=$1 [L] # Profile

Upvotes: 0

Views: 34

Answers (2)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([^/]+)$ /profile.php?name=$1 [L]

Upvotes: 0

Black Sheep
Black Sheep

Reputation: 6694

Try this one:

RewriteRule ^([A-Za-z_]+)$ profile.php?name=$1 [NC,B,QSA]

Upvotes: 1

Related Questions