我有一个真的简单mod_rewrite
规则:
<Directory "/local/foobar.com/">
RewriteEngine On
RewriteBase /
RewriteRule ^test$ hello/ [R]
</Directory>
在 Chrome 中,当我访问 时www.foobar.com/test
,我会被重定向到www.foobar.com/hello/
,但在 IE9 中,没有发生重定向 - 我错过了什么?!
更多信息
根据评论的要求,记录输出:
铬合金:
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (3) [perdir /local/foo.com/] strip per-dir prefix: /local/foo.com/test -> test
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (3) [perdir /local/foo.com/] applying pattern '^test$' to uri 'test'
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (2) [perdir /local/foo.com/] rewrite 'test' -> 'hello/'
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (3) [perdir /local/foo.com/] add per-dir prefix: hello/ -> /local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (2) [perdir /local/foo.com/] explicitly forcing redirect with http://foo.com/local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (2) [perdir /local/foo.com/] trying to replace prefix /local/foo.com/ with /
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (1) [perdir /local/foo.com/] escaping http://foo.com/hello/ for redirect
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420002978/initial] (1) [perdir /local/foo.com/] redirect to http://foo.com/hello/ [REDIRECT/302]
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420006998/initial] (3) [perdir /local/foo.com/] add path info postfix: /local/foo.com/hello -> /local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420006998/initial] (3) [perdir /local/foo.com/] strip per-dir prefix: /local/foo.com/hello/ -> hello/
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420006998/initial] (3) [perdir /local/foo.com/] applying pattern '^test$' to uri 'hello/'
192.171.135.86 - - [16/Nov/2015:17:56:39 +0000] [foo.com/sid#7f4458ffddc8][rid#7f4420006998/initial] (1) [perdir /local/foo.com/] pass through /local/foo.com/hello
IE9:
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (3) [perdir /local/foo.com/] strip per-dir prefix: /local/foo.com/test -> test
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (3) [perdir /local/foo.com/] applying pattern '^test$' to uri 'test'
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (2) [perdir /local/foo.com/] rewrite 'test' -> 'hello/'
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (3) [perdir /local/foo.com/] add per-dir prefix: hello/ -> /local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (2) [perdir /local/foo.com/] explicitly forcing redirect with http://foo.com/local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (2) [perdir /local/foo.com/] trying to replace prefix /local/foo.com/ with /
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (1) [perdir /local/foo.com/] escaping http://foo.com/hello/ for redirect
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f440c00a9b8/initial] (1) [perdir /local/foo.com/] redirect to http://foo.com/hello/ [REDIRECT/302]
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f44101b7688/initial] (3) [perdir /local/foo.com/] add path info postfix: /local/foo.com/hello -> /local/foo.com/hello/
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f44101b7688/initial] (3) [perdir /local/foo.com/] strip per-dir prefix: /local/foo.com/hello/ -> hello/
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f44101b7688/initial] (3) [perdir /local/foo.com/] applying pattern '^test$' to uri 'hello/'
192.171.135.86 - - [16/Nov/2015:18:01:45 +0000] [foo.com/sid#7f4458ffddc8][rid#7f44101b7688/initial] (1) [perdir /local/foo.com/] pass through /local/foo.com/hello
答案1
我最终意识到发生了什么。我实际上没有一个名为的文件夹hello
- 我只是想测试一个抽象mod_rewrite
规则。似乎 Chrome 会遵循重定向,而不管返回的任何 http 代码,但如果随后返回 404,IE 将不会显示重定向。
一旦我添加了一个名为hello
IE 的文件夹做过遵守规则。