apache url rewrite重写后前台的html,js,css文件找不到
url rewrite重写后前台的html,js,css文件找不到,页面能正常访问,配置规则如下
Options +FollowSymLinks -Multiviews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d # 不是目录
RewriteCond %{REQUEST_FILENAME} !-l #
RewriteRule ^(((?!index\.php).)*)$ index.php/$1 [L,QSA]
规则中少了对文件的判断,所以在访问文件时url也被重写
解决:
Options +FollowSymLinks -Multiviews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d # 不是目录
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f #不是文件
RewriteRule ^(((?!index\.php).)*)$ index.php/$1 [L,QSA]