Hey guys. I'm new to url rewrites but I can't seem to figure out why this is not working
I have the link: http://thoughtsmash.com/profile.php?name=1
That I want to rewrite to: http://thoughtsmash.com/profilename/1
and I have this in my .htaccess file:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{H开发者_JAVA技巧TTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
RewriteRule ^/profilename/([0-9_]+)$ /profile.php?name=$1 [NC]
But it does nothing! The removal of the "www." works fine but the rest doesn't. Any ideas as to why? Thanks
Try this:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
RewriteRule ^profilename/([0-9_]+)$ /profile.php?name=$1 [NC]
Note that I added RewriteBase
and removed leading /
精彩评论