0

我有一个页面:

http://domain.com/index.php

但奇怪的是,以下内容urls也在工作并呈现相同的页面:

http://domain.com/index.php/abcd
http://domain.com/index.php/gefe

等等..

显然,这似乎是一个搞砸的regex配置。但奇怪的是,即使我删除了我的.htaccess文件,这些网址仍然有效。

现在,我只能将此归咎于我的apache配置,但一切似乎都符合预期。

我的阿帕奇配置:

<VirtualHost *:80>
    # Server name
    ServerName domain.com
    # Document root
    DocumentRoot /path/to/source

    <Directory />
        Options FollowSymLinks
    </Directory>
    <Directory /path/to/source>
        AllowOverride All
        Options Indexes FollowSymLinks MultiViews
        Order allow,deny
        allow from all
    </Directory>

    LogLevel error

    # Logs
    ErrorLog ${APACHE_LOG_DIR}/domain_error.log
    CustomLog ${APACHE_LOG_DIR}/domain_access.log combined

    RewriteMap  lc int:tolower
</VirtualHost>

谁能指出错误?

4

2 回答 2

1

它被称为 PATH_INFO。Apache 将从左到右扫描 URL。只要找到匹配的目录,它就会继续执行文档根目录,直到它用完目录或找到匹配的脚本。之后,任何额外的“路径”信息都会变成 PATH_INFO,例如

您在 /a/b/c 的真正存在的目录结构中有一个名为“foo.php”的脚本的站点,因此

http://example.com/a/b/c/foo.php

是一个有效的网址。

在这种情况下,

http://example.com/a/b/c/foo.php/bar/baz/bip/bop/boop
                                ^^^^^^^^^^^^^^^^^^^^^-- path info

阅读:http ://httpd.apache.org/docs/current/mod/core.html#acceptpathinfo

于 2013-06-04T17:57:48.297 回答
1

添加到这样的 URL 是完全合法的 - 额外路径可用于您的 PHP 代码$_SERVER['PATH_INFO']

这与说 没有什么不同http://domain.com/index.php?ab=cd,只是将更多信息添加到 URL 的不同方式。

于 2013-06-04T17:55:56.800 回答