Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 为什么RewriteCond不能在httd.conf中工作?_Apache_Mod Rewrite_Yii2 - Fatal编程技术网

Apache 为什么RewriteCond不能在httd.conf中工作?

Apache 为什么RewriteCond不能在httd.conf中工作?,apache,mod-rewrite,yii2,Apache,Mod Rewrite,Yii2,我有一个网站正在使用yii2web框架,我试图用apache做的是在请求不是ask-for-js或css文件时重写url。下面是我的配置: #in httpd.conf <VirtualHost *:80> DocumentRoot /Users/shenshijun/Sites/intuplus/frontend/web ServerName intuplus RewriteEngine On <

我有一个网站正在使用yii2web框架,我试图用apache做的是在请求不是ask-for-js或css文件时重写url。下面是我的配置:

    #in httpd.conf
   <VirtualHost *:80> 
        DocumentRoot /Users/shenshijun/Sites/intuplus/frontend/web
        ServerName intuplus
        RewriteEngine On
        <IfModule rewrite_module>

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^/(.*)$ /index.php/$1

            LogLevel alert rewrite:trace3
        </IfModule>
    </VirtualHost>
httpd.conf中的
#
DocumentRoot/Users/shenshijun/Sites/intuplus/frontend/web
服务器名intuplus
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^/(.*)$/index.php/$1
日志级别警报重写:trace3
js文件的url如下所示:,当我删除重写规则时可以访问它。但当我添加rewriterule和rewritecond时,url无论如何都是重写的,我无法访问js文件或css文件。有人能解释一下为什么RewriteCond不在这里工作吗


哦,apache版本:
服务器版本:apache/2.4.10(Unix)

您的重写规则错误,您应该尝试以下操作:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

阅读更多内容:

我使用正则表达式,你能解释一下为什么它不起作用吗?