我有一个这样的网址:
http://my.site/apps/123
我想重定向到
http://my.site/app/123
使用 mod_rewrite。但是,当我使用这个 .htaccess 时:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^/apps/(.*)$ /app/$1 [R=301,L]
RewriteRule ^(.*)$ /index.php?/$1 [L]
我在日志中收到 500 和此错误:
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.
[Thu Sep 13 12:58:13 2012] [debug] core.c(3112): [client 127.0.0.1] r->uri = /index.php
浏览器中的最终 URL 如下所示:
http://my.site/app/123?/apps/123
为什么 Apache 将 ?/apps/123 附加到 URL 上?
我想如果我可以避免这种情况,那么我可以避免这里的无限递归问题。