htaccess重写规则正在做一些奇怪的事情

时间:2016-05-14 21:39:02

标签: apache .htaccess mod-rewrite

我的htaccess中有这个

 RewriteRule ^(.*)$ /index.php/$1 [QSA,L]

当我去我的网站时

https://testsite.com/ProductsCatalog/Vertical/Boards

我收到内部服务器错误。

要调试我添加了一个调试标志,它显示了这个

[Sat May 14 15:33:04.430655 2016] [rewrite:trace2] [pid 38242] mod_rewrite.c(476): [client 127.0.0.1:52126] 127.0.0.1 - - [site/sid#7ffae3005dc8][rid#7ffae4879678/initial/redir#10] [perdir /Library/WebServer/Documents/site/] rewrite 'index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/ProductsCatalog/Vertical/Boards' -> '/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/ProductsCatalog/Vertical/Boards'
[Sat May 14 15:33:04.430663 2016] [rewrite:trace2] [pid 38242] mod_rewrite.c(476): [client 127.0.0.1:52126] 127.0.0.1 - - [site/sid#7ffae3005dc8][rid#7ffae4879678/initial/redir#10] [perdir /Library/WebServer/Documents/site/] trying to replace context docroot /Library/WebServer/Documents/site with context prefix
[Sat May 14 15:33:04.430669 2016] [rewrite:trace1] [pid 38242] mod_rewrite.c(476): [client 127.0.0.1:52126] 127.0.0.1 - - [site/sid#7ffae3005dc8][rid#7ffae4879678/initial/redir#10] [perdir /Library/WebServer/Documents/site/] internal redirect with /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/ProductsCatalog/Vertical/Boards [INTERNAL REDIRECT]

1 个答案:

答案 0 :(得分:1)

您必须将要重写的目的地排除在外:

^(.*)$

否则您将收到重写循环错误,因为模式index.php也匹配uri [program:worker1] command=celery worker -l info -n worker1 [program:worker2] command=celery worker -l info -n worker2 [group:workers] programs=worker1,worker2