我不明白为什么我的网址重写不起作用
嘿伙计们。 我是 url 重写的新手,但我似乎无法弄清楚为什么这不起作用
我有链接: http://thoughtsmash.com/profile.php?name=1
我想重写为: http://thoughtsmash.com/profilename/1
我的 .htaccess 文件中有这个:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
RewriteRule ^/profilename/([0-9_]+)$ /profile.php?name=$1 [NC]
但它什么也没做!删除“www”。工作正常,但其余部分不行。有什么想法吗?谢谢
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 %{HTTP_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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
请注意,我添加了
RewriteBase
并删除了前导/
Try this:
Note that I added
RewriteBase
and removed leading/