Apache 2.4 mod_rewrite奇怪的内部重定向到域名

时间:2016-09-09 15:37:21

标签: apache .htaccess redirect mod-rewrite

我对apache 2.4有一个非常奇怪的问题。

如果我启用mod_rewrite并转到无法找到的页面,那么apache会进行非常奇怪的内部重定向。重定向与我的某个域名相关联,但我不明白这是从哪里来的。

我所做的是以下内容:

为简单起见,我已将这些添加到http.conf:

AppBarLayout appBarLayout = findViewById(...);
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
                shouldScroll = Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange();
            }
        });
NestedScrollView nestedScrollView = findViewById(...);
nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
            @Override
            public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
                if (!shouldScroll)
                    nestedScrollView.fullScroll(ScrollView.FOCUS_UP);
            }
        });

现在,这是奇怪的事情。如果我请求一个不存在的页面,例如:http://projects.test/test我收到内部服务器错误。

trace4登录error.log:

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

我无法弄清楚用 /interpid.eu/index.php 域名完成此重定向的位置???它可能与我的电脑有关......但不知道是什么。

[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]

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

哦,该死的。我在&#34; D:/。htaccess&#34;上有一个.htaccess文件。有了这个内容......

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /interpid.eu/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /interpid.eu/index.php [L]
</IfModule>

尽管如此,我认为只有DocumentRoot&#34; d:/ Empty&#34;将考虑.htaccess文件。