0
我想写以下规则(见注释)阿帕奇重写规则国旗代理NS
# Redirect example.org/sub/* to sub.example.org/* explicitly
RewriteCond %{REQUEST_URI} ^/sub(.+)$ [NC]
RewriteRule^http://sub.%{HTTP_HOST}%1 [L,R=301,NS]
# Redirect sub.example.org/* to example.org/sub/* internally
RewriteCond %{HTTP_HOST} ^sub\.(.+)$ [NC]
RewriteRule^http://%1/sub%{REQUEST_URI} [L,P,NS]
即使NS标志,当我打sub.example.org/foo我得到过多的重定向,在这里是RewriteLog
applying pattern '^' to uri 'foo'
rewrite 'foo' -> 'http://example.org/sub/foo'
escaped URI in per-dir context for proxy, http://example.org/sub/foo -> http://example.org/sub/foo
forcing proxy-throughput with http://example.org/sub/foo
go-ahead with proxy request proxy:http://example.org/sub/foo [OK]
applying pattern '^' to uri 'sub/foo'
rewrite 'sub/foo' -> 'http://sub.example.org/foo'
explicitly forcing redirect with http://sub.example.org/foo
escaping http://sub.example.org/foo for redirect
redirect to http://sub.example.org/foo [REDIRECT/301]
上和