坏旗分隔符.htaccess

时间:2014-03-10 04:34:53

标签: apache .htaccess mod-rewrite

我正在测试网址重写,但我遇到了htacces的问题。我有

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} != d
RewriteCond %{REQUEST_FILENAME} != f
RewriteCond %{REQUEST_FILENAME} != l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

我的vhost看起来像

<VirtualHost *:80>
        ServerAdmin webmaster@sitename.com
        ServerName www.mvc.com
        ServerAlias my.mvc

        DocumentRoot /home/user/Documents/MyMVC

        <Directory /home/user/Documents/MyMVC>
            Require all granted
            AllowOverride all
        </Directory>

        ErrorLog /home/user/SiteLogs/mvc/error.log
</VirtualHost>

使用此设置我得/home/user/Documents/MyMVC/.htaccess: RewriteCond: bad flag delimiters我不知道我错过了什么。提前谢谢。

2 个答案:

答案 0 :(得分:1)

!=在RewriteConds中不是有效选项:http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

RewriteCond %{REQUEST_FILENAME} !-d
                                 ^--- "dash", not "equals"

答案 1 :(得分:1)

重写条件不是标志“!=” 应该看起来像这样

RewriteCond %{REQUEST_FILENAME} !-f