我有下面的重写规则,但是除了最后一次重写以外,所有的重写都停止了。Apache mod_rewrite'loop'/ Last last functioning
的文件夹结构类似于:
/
/site
/console
/requests
如果我去http://xx.com/contact,它本质上是显示我,http://xx.com/site/contact。这很好。但是,如果我去http://xx.com/console,这是行不通的。我相信这与我的最终规则接管有关,但我看不出如何。从本质上讲,当我去http://xx.com/console,它应该带我到http://xx.com/console,但是,我相信它试图带我到http://xx.com/site/console这是不存在的!
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?xx.org.uk$
RewriteRule ^wp-content/uploads/2012/05/banner.png$ http://xx.org.uk/site/wp-content/uploads/2012/05/banner.png [L,R=301]
RewriteRule ^questions(.*)$ http://xx.org.uk/questions/ [L,R=301]
RewriteRule ^survey(.*)$ http://xx.org.uk/xx-2014-survey/ [L,R=301]
RewriteRule ^console/([^/.]+)$ http://xx.org.uk/console/?id=$1 [L,R=301]
RewriteRule ^requests/([^/.]+)$ http://xx.org.uk/requests/?id=$1 [L,R=301]
RewriteCond %{REQUEST_URI} !^/site/
RewriteRule ^(.*)$ /site/$1 [L,NC]
[L]和[END]之间的区别很微妙,不太可能与此相关。正如[手册](http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_end)所表明的那样:“这不适用于由外部重定向产生的新请求。” - 由于[R]标志的存在,肯定*涉及*。 – IMSoP 2015-03-24 23:24:27
对“END”的同意引用不适用于外部重定向。 – anubhava 2015-03-25 06:56:27