这是我的代码:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond application/public/%{REQUEST_FILENAME} -f
RewriteRule (.*) application/public/$1 [L]
我想表达:
{REQUEST_FILENAME}
不存在,如果文件application/public/%{REQUEST_FILENAME}
存在,请重写示例结果:
这个表达式的正确代码是什么?我想我需要换行:
RewriteCond application/public/%{REQUEST_FILENAME} -f
但我没有血腥的想法......
完整.htaccess列表:
RewriteEngine on
RewriteRule style,(.+).css tmp/merged/css,$1 [L,QSA]
RewriteRule script,(.+).js tmp/merged/js,$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond application/public/%{REQUEST_FILENAME} -f
RewriteRule (.*) application/public/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php?input=$1 [L,QSA]
(对不起我的英文)
答案 0 :(得分:0)
我发现了一个小的解决方法,但它并不是优雅的解决方案:(
RewriteEngine on
# Access to files in ./application/public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) application/public/$1 [DPI]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule application/public/(.*) $1 [DPI]
# Main rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php?input=$1 [L,QSA,DPI]