我需要帮助。
我浪费了半小时来获得mod_rewrite
规则。不成功。
我的服务器根结构是:
/project/public_html/index.html
/project/public_html/css/style.css
/project/public_html/js/script.js
我想从我的localhost访问它:
/project/index.html
/project/css/style.css
/project/js/script.js
我在/project/.htaccess
:
RewriteEngine On
RewriteBase /project
RewriteRule ^(.+)$ public_html/$1 [L,QSA,NS]
但我还是得到了这个:
[Thu Dec 05 12:29:20.252091 2013] [core:error] [pid 26176] [client 127.0.0.1:60642] AH00124: 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 Dec 05 12:29:20.252111 2013] [core:debug] [pid 26176] core.c(3520): [client 127.0.0.1:60642] AH00122: redirected from r->uri = /project/public_html/public_html/public_html/public_html/public_html/public_html/public_html/public_html/public_html/index.html
问题应该非常简单,但Google和手册都没有帮助我。
提前致谢。
答案 0 :(得分:1)
使用附加条件停止循环来试用此规则。此条件首先检查/public_html
是否已插入请求URI。
RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_URI} !/public_html/ [NC]
RewriteRule ^(.*)$ public_html/$1 [L,NS]