我的问题是这个,
现在我必须链接到/theme/css/somecssfile.css,
我想要做的就是这个
/css/somecssfile.css,但仍然将物理文件保存在/ theme /.
这是我目前的.htaccess
# Enable Rewriting
RewriteEngine on
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|files\/images|files\/css|files\/js|files\/swf|files\/upload)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
答案 0 :(得分:1)
在RewriteEngine On
行:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?\.css)$ /theme/$1 [L,NC]
如果您还想在此规则中加入.js
,请使用:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?\.(?:css|js))$ /theme/$1 [L,NC]