use*_*853 23 apache .htaccess inheritance
我的主要public_html目录具有以下.htaccess规则:
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)
问题是,我有一个名为source的子目录,我希望该目录只列出其中的文件(因为没有索引文件).问题是上面的父目录的htaccess规则导致源中没有文件显示在目录索引中(它只列出一个空索引).
我怎么解决这个问题?
谢谢
anu*_*ava 21
用这个改变你的.htaccess:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# if request is not for the /sub-dir/
RewriteCond %{REQUEST_URI} !^/sub-dir/ [NC]
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)