我是重写网址的新手,想知道如何重写
由此
/个人资料/4
对此
/profile.php?id=4
到目前为止我有这个规则
RewriteRule ^profile/([0-9]+)/?$ profile.php?id=$1
但它在浏览器中显示这个
Firefox 检测到服务器正在以永远无法完成的方式重定向对此地址的请求。
它在浏览器地址栏中显示/profile/4/index.php,这是不正确的。
.htaccess 文件
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options +FollowSymlinks
RewriteEngine on
#ErrorDocument 404 /test.php
DirectoryIndex test.php
RewriteRule settings editProfile.php
RewriteRule update update.php
RewriteRule home test.php
RewriteRule ^profile/([0-9]+)/?$ profile.php?id=$1
你已经差不多了。尝试使用这个代替
RewriteRule ^profile/(.*)$ profile.php?id=$1
我在网上找到了这个很好的免费资源来帮助你测试你的重写规则 http://martinmelin.se/rewrite-rule-tester/在将它们发布到您的实时网站之前。这可能对未来有所帮助。看来您的规则应该像您发布的那样起作用。问题一定出在其他地方。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)