[英]I can't figure out why my url rewrite isn't working
大家好。 我是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。”。 工作正常,但其余的則不行。 有什么想法嗎? 謝謝
嘗試這個:
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]
請注意,我添加了RewriteBase
並刪除了前導/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.