Mod_rewrite用户id错误


mod_rewrite user id error

我是重写url的新手,想知道如何重写

/资料/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

我在网上找到了这个很好的免费资源,可以帮助你在发布到你的现场网站之前测试你的重写规则。这可能对未来有所帮助。看起来你的规则应该像你发布的那样工作。

你的规则很好,所以有一个重定向与它冲突。我猜你在/profile/4没有一个真正的目录,所以他们的主要候选人是mod_negotiation。试试这个:

Options -MultiViews