Apache 为什么RewriteCond不能在httd.conf中工作?
我有一个网站正在使用yii2web框架,我试图用apache做的是在请求不是ask-for-js或css文件时重写url。下面是我的配置: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 <
#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
阅读更多内容:我使用正则表达式,你能解释一下为什么它不起作用吗?