htaccess 重写给我 500 错误?
我有一个我想使其友好的网址,在 .htacess 上使用重写,但它给了我一个错误(500内部服务器错误),这是我原来的php网址
http://www.example.com/viewtopic.php?topic=lovetopic
我想将其更改为:
http://www.example.com/lovetopic
这是我的整个htaccess代码是这:
RewriteEngine On
RewriteRule ^user/([^/]*)$ /viewprofile.php?user=$1 [L]
RewriteRule ^([^/]*)$ /viewtopic.php?topic=$1 [L]
我不知道问题是什么
编辑服务器错误日志给了我这个错误
[Thu Oct 14 20:34:36 2010] [error] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.,
i have this url that i wanted to make friendly, using rewrite on .htacess but it gives me an error(500 internal server error), this is my orginal php url
http://www.example.com/viewtopic.php?topic=lovetopic
i want to change it to this:
http://www.example.com/lovetopic
this is my whole htaccess code is this:
RewriteEngine On
RewriteRule ^user/([^/]*)$ /viewprofile.php?user=$1 [L]
RewriteRule ^([^/]*)$ /viewtopic.php?topic=$1 [L]
i dont know what the problem is
EDIT the server error log is giving me this error
[Thu Oct 14 20:34:36 2010] [error] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第二条规则
^([^/]*)$
的模式也与不带路径前缀/
的/viewtopic.php
匹配,即viewtopic.php
。这就是为什么你有无限递归。您可以使用以下条件来排除:
或者使用此条件来排除所有现有文件:
或者在其他规则前面使用此规则来阻止可以映射到由任何以下规则重写的现有文件的每个请求:
The pattern of your second rule
^([^/]*)$
does also match/viewtopic.php
without the path prefix/
, i.e.viewtopic.php
. That’s why you’re having an infinite recursion.You can use the following condition to exclude that:
Or use this condition to exclude all existing files:
Or use this rule in front of you other rules to stop every request that can be mapped to an existing file being rewritten by any following rules: