我一直在努力让过去两个小时没有任何运气的情况下工作。我在谷歌和Apache文档上寻找帮助,但我仍然无法找到一个出路。事情是这样的:.htaccess RewriteCond在重写后测试
我有两个文件:
index.php
public/css/screen.css
我想在浏览器中输入的任何URL重定向到index.php URL = $ 1,如果它不是一个文件。如果是,它应该重定向到public/$ 1。我尝试使用以下重写规则:
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule (.*) public/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?url=$1 [QSA,L]
不幸的是,由于重写只发生的RewriteCond满足后,前两个的RewriteCond将测试针对CSS/screen.css,而不是公共/ CSS/screen.css。
是否有一个神奇的标志,告诉Apache做RewriteRule,测试RewriteConds是否为真,然后撤消重写,如果不是?你们会怎么做?
感谢