.htaccess中的RewriteRule用于提供精确的文件(不是URI)

时间:2014-09-01 19:46:29

标签: apache .htaccess mod-rewrite

我的.htaccess中有DocumentRoot

DirectorySlash      Off
RewriteEngine       On
RewriteRule         ^(.*)$          /views/Dispatch.php [END]

如果我将Deny From All指令放在.htaccess /views/内,Apache会给出一个HTTP403,所以我假设Apache正在考虑将/views/Dispatch.php作为URI传递给其他人.htaccess而不是直接服务器的文件。

Apache的error.log收益率(LogLevel rewrite_module:trace8):

[Tue Sep 02 09:25:01.636536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12bd3b0/initial] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] strip per-dir prefix: N:/web/binaries/easy-php/14.1/data/localweb/ -> 
[Tue Sep 02 09:25:01.637536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12bd3b0/initial] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] applying pattern '^(.*)$' to uri ''
[Tue Sep 02 09:25:01.637536 2014] [rewrite:trace2] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12bd3b0/initial] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] rewrite '' -> '/views/Dispatch.php'
[Tue Sep 02 09:25:01.637536 2014] [rewrite:trace8] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12bd3b0/initial] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] Rule has END flag, no further rewriting for this request
[Tue Sep 02 09:25:01.637536 2014] [rewrite:trace1] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12bd3b0/initial] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] internal redirect with /views/Dispatch.php [INTERNAL REDIRECT]
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] strip per-dir prefix: N:/web/binaries/easy-php/14.1/data/localweb/index.html -> index.html
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] applying pattern '^(.*)$' to uri 'index.html'
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace2] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] rewrite 'index.html' -> '/views/Dispatch.php'
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace8] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] Rule has END flag, no further rewriting for this request
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace1] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] internal redirect with /views/Dispatch.php [INTERNAL REDIRECT]
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] strip per-dir prefix: N:/web/binaries/easy-php/14.1/data/localweb/index.xml -> index.xml
[Tue Sep 02 09:25:01.638536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] applying pattern '^(.*)$' to uri 'index.xml'
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace2] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] rewrite 'index.xml' -> '/views/Dispatch.php'
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace8] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] Rule has END flag, no further rewriting for this request
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace1] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] internal redirect with /views/Dispatch.php [INTERNAL REDIRECT]
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] strip per-dir prefix: N:/web/binaries/easy-php/14.1/data/localweb/index.php -> index.php
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace3] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] applying pattern '^(.*)$' to uri 'index.php'
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace2] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] rewrite 'index.php' -> '/views/Dispatch.php'
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace8] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] Rule has END flag, no further rewriting for this request
[Tue Sep 02 09:25:01.639536 2014] [rewrite:trace1] [pid 2316:tid 1004] mod_rewrite.c(468): [client 127.0.0.1:49769] 127.0.0.1 - - [127.0.0.1/sid#47a2e8][rid#12c13c0/subreq] [perdir N:/web/binaries/easy-php/14.1/data/localweb/] internal redirect with /views/Dispatch.php [INTERNAL REDIRECT]
[Tue Sep 02 09:25:01.639536 2014] [access_compat:error] [pid 2316:tid 1004] [client 127.0.0.1:49769] AH01797: client denied by server configuration: N:/web/binaries/easy-php/14.1/data/localweb/views/Dispatch.php

如何告诉Apache(2.4.7)提供/views/Dispatch.php文件(来自服务器的文件系统)而不是将其视为URI?

0 个答案:

没有答案