0

我有问题。我正在尝试获取此网址:

mySite.com/index.php?url=category/value1/value2/value3

由此:

MySite.com/category/value1/value2/value3

我有这个 .htaccess 文件:

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
</IfModule>

如果类别是除“索引”之外的所有内容,则一切正常,所以如果我输入 URL:

MySite.com/content/tv/color

数组 $_GET 等于:

Array
(
    [url] => content/tv/color/
)

但是当我说:

MySite.com/index/option1/option2

数组为空

Array()

我检查了我的 apache.conf 文件,但看不到问题。

<VirtualHost *:80>
        ServerAdmin user@site.com

        DocumentRoot /home/htdocs
        <Directory />
                AllowOverride all
        </Directory>
        <Directory /home/htdocs>
                #>>>>>HERE I HAVE MY TEST APP <<<<<<<<
                DirectoryIndex index.html index.php
                Options FollowSymLinks MultiViews
                RewriteEngine ON
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>
        Alias /simplesaml /var/simplesamlphp/www
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
4

1 回答 1

1

您需要通过在它之前MultiViews添加减号来关闭选项。--MultiViews

实际上我不确定你为什么明确打开它。它只是一个配置复制粘贴吗?

另外,如果您不需要FollowSymLinks(我确定您不需要它)-也将其关闭。

于 2013-03-20T23:07:29.637 回答