1
存在我有一个文件的结构是这样的:重写文件,如果在子目录
root
|- public
|- file.jpeg
|- file.txt
|- .htaccess
|- index.php
现在,我要重写example.com/file.jpeg
到example.com/public/file.jpeg
与同为file.txt的和public
目录中所有其他文件,但如果文件不子目录存在,则改写到index.php
出于某种原因,这个改写的.htaccess一切的index.php
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/public/$1 -f
RewriteRule ^(.*)$ public/$1 [L]
RewriteRule ^(.*)$ index.php [L]
我的代码有什么问题?
但随后在根的其他文件不被改写,这是我想避免的。 – vsakos 2015-02-06 23:23:44
我想你不理解我。我想将/file.jpeg重写为/public/file.jpeg(如果存在),但是要将每个其他请求都写入index.php,甚至直接/public/file.jpeg。这可能吗? – vsakos 2015-02-07 11:30:12
我需要这样的东西:http://pastebin.com/Uvptr6st – vsakos 2015-02-07 11:59:03