【发布时间】:2013-07-04 12:38:38
【问题描述】:
我的.htaccess 文件中有此代码,用于将用户路由到我的root/index.php 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
但是,这很好用:所以如果我要去 localhost/MyFolder/Xyz 并且如果 Xyz is not existing it takes me to localhost/index.php 现在我想要的是,我有像 css js images 这样的文件夹,所以我没有任何 @ 987654329@ 文件在那里,所以它列出了我所有的文件。我知道我可以在那里添加 index.php 文件,并且可以将用户重定向到我的根目录。但这是一项 TDS 工作。有什么方法可以让我在.htaccess 和任何文件夹中做某事,如果它无法找到index.php,它会将我带到localhost 的index.php?
有办法吗。只是不想将index.php 放在每个文件夹中以限制其访问。
【问题讨论】:
标签: php linux apache .htaccess web