我有一个非常奇怪的问题与apache 2.4有一段时间了。
如果我启用mod_rewrite,而我进入了一个找不到的页面,那么apache会做一个非常奇怪的内部重定向,这个重定向链接到我的一个域,但是我不知道这个重定向是从哪里来的。
我所做的如下:
- 已安装http://de.apachehaus.com/downloads/httpd-2.4.23-x64-vc14.zip
- 我正在使用Windows 10
- 目标目录是空的,没有.htaccess或任何东西
为了简单起见,我在http.conf中添加了以下内容:
LoadModule rewrite_module modules/mod_rewrite.so
<VirtualHost *:80>
DocumentRoot "d:/Empty"
ServerName projects.test
<Directory />
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
LogLevel debug rewrite:trace1
现在,这里是奇怪的事情来了。如果我请求一个不存在的页面,例如:http://projects.test/test我收到内部服务器错误。
error.log中的trace 4日志记录:
[Fri Sep 09 17:53:57.325193 2016] [mpm_winnt:debug] [pid 22932:tid 1116] child.c(399): AH00334: Child: Accept thread listening on [::]:443 using AcceptFilter data
[Fri Sep 09 17:53:57.325693 2016] [mpm_winnt:debug] [pid 22932:tid 1148] child.c(399): AH00334: Child: Accept thread listening on [::]:80 using AcceptFilter data
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(393): [client ::1:62560] Headers received from client:
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Host: localhost
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Connection: keep-alive
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Cache-Control: max-age=0
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Upgrade-Insecure-Requests: 1
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] DNT: 1
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Accept-Encoding: gzip, deflate
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Accept-Language: en,de;q=0.8,en-US;q=0.6
[Fri Sep 09 17:54:01.843332 2016] [http:trace4] [pid 22932:tid 1072] http_request.c(396): [client ::1:62560] Cookie: Phpstorm-f6f7591a=a1280346-7ebc-47e4-a371-0046f15ed62f
[Fri Sep 09 17:54:01.843833 2016] [authz_core:debug] [pid 22932:tid 1072] mod_authz_core.c(806): [client ::1:62560] AH01626: authorization result of Require all granted: granted
[Fri Sep 09 17:54:01.843833 2016] [authz_core:debug] [pid 22932:tid 1072] mod_authz_core.c(806): [client ::1:62560] AH01626: authorization result of <RequireAny>: granted
[Fri Sep 09 17:54:01.843833 2016] [core:trace3] [pid 22932:tid 1072] request.c(291): [client ::1:62560] request authorized without authentication by access_checker_ex hook: /test
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] strip per-dir prefix: D:/Empty/test -> Empty/test
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] applying pattern '^index\\.php$' to uri 'Empty/test'
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] strip per-dir prefix: D:/Empty/test -> Empty/test
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] applying pattern '.' to uri 'Empty/test'
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] RewriteCond: input='D:/Empty/test' pattern='!-f' => matched
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] RewriteCond: input='D:/Empty/test' pattern='!-d' => matched
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] rewrite 'Empty/test' -> '/interpid.eu/index.php'
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] trying to replace prefix D:/ with /interpid.eu/
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] trying to replace context docroot D:/Empty with context prefix
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace1] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] internal redirect with /interpid.eu/index.php [INTERNAL REDIRECT]
[Fri Sep 09 17:54:01.844334 2016] [authz_core:debug] [pid 22932:tid 1072] mod_authz_core.c(806): [client ::1:62560] AH01626: authorization result of Require all granted: granted
[Fri Sep 09 17:54:01.844334 2016] [authz_core:debug] [pid 22932:tid 1072] mod_authz_core.c(806): [client ::1:62560] AH01626: authorization result of <RequireAny>: granted
[Fri Sep 09 17:54:01.844334 2016] [core:trace3] [pid 22932:tid 1072] request.c(291): [client ::1:62560] request authorized without authentication by access_checker_ex hook: /interpid.eu/index.php
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] add path info postfix: D:/Empty/interpid.eu -> D:/Empty/interpid.eu/index.php
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] strip per-dir prefix: D:/Empty/interpid.eu/index.php -> Empty/interpid.eu/index.php
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] applying pattern '^index\\.php$' to uri 'Empty/interpid.eu/index.php'
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] add path info postfix: D:/Empty/interpid.eu -> D:/Empty/interpid.eu/index.php
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] strip per-dir prefix: D:/Empty/interpid.eu/index.php -> Empty/interpid.eu/index.php
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] applying pattern '.' to uri 'Empty/interpid.eu/index.php'
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] RewriteCond: input='D:/Empty/interpid.eu' pattern='!-f' => matched
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] RewriteCond: input='D:/Empty/interpid.eu' pattern='!-d' => matched
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] rewrite 'Empty/interpid.eu/index.php' -> '/interpid.eu/index.php'
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] trying to replace prefix D:/ with /interpid.eu/
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] trying to replace context docroot D:/Empty with context prefix
[Fri Sep 09 17:54:01.844334 2016] [rewrite:trace1] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea5cc58/initial/redir#1] [perdir D:/] internal redirect with /interpid.eu/index.php [INTERNAL REDIRECT]
我不知道这个重定向是从哪里完成的**/interpid.eu/index.php**域???它可能有一些与我的电脑...但不知道是什么。
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace3] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] applying pattern '.' to uri 'Empty/test'
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] RewriteCond: input='D:/Empty/test' pattern='!-f' => matched
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace4] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] RewriteCond: input='D:/Empty/test' pattern='!-d' => matched
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] rewrite 'Empty/test' -> '/interpid.eu/index.php'
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] trying to replace prefix D:/ with /interpid.eu/
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace2] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] trying to replace context docroot D:/Empty with context prefix
[Fri Sep 09 17:54:01.843833 2016] [rewrite:trace1] [pid 22932:tid 1072] mod_rewrite.c(477): [client ::1:62560] ::1 - - [localhost/sid#1f54cf16858][rid#1f54ea562a0/initial] [perdir D:/] internal redirect with /interpid.eu/index.php [INTERNAL REDIRECT]
任何帮助都很感激。
2条答案
按热度按时间b91juud31#
哦,该死。我在“D:/.htaccess”上有一个.htaccess文件,里面有这个内容...
尽管如此,我仍然认为对于.htaccess文件,只会考虑DocumentRoot“d:/Empty”。
hfyxw5xn2#
这是正确的。.htaccess文件一直向上查找到根文件夹,而不是document_root。