我有一个小问题。我已经建立了一个系统,它正在使用.htaccess来将流量定向到正确的位置。
现在我有以下.htaccess数据
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
RewriteRule (.*) core/$1 [L]
///### (does not work.. this is a problem) RewriteRule (.*) app/template/ !page [L]
</IfModule>
问题实际上是,当我想显示位于/ app / templates中的.css文件时,它也重定向到/ core /
我试图做一个例外。但是,按照我的方法,这似乎并没有奏效。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
RewriteRule (.*) core/$1 [L]
RewriteRule (.*) app/template/ !page [L]
</IfModule>
此.htaccess给出500错误。谁能告诉我我在做什么错?以及如何使异常适用于模板目录?
不 !!
您应该使用:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ core/ [L]
# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) core/$1 [L]
</IfModule>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句