我想在.htaccess中排除子文件夹“web”,但它不起作用。
.htaccess位于根目录中。而“web”文件夹是它的子文件夹。
所以,我试过这个:
<IfModule mod_rewrite.c>
RewriteEngine On
# turn empty requests into requests for "index.php",
# keeping the query string intact
RewriteRule ^$ index.php [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !favicon.ico$
# Folders to exclude from rewrite divided by Pipe goes here:
RewriteCond %{REQUEST_URI} /.+\/web\/.+/
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
答案 0 :(得分:0)
I would like to exclude the subfolder "web" in my .htaccess
这样的规则可以排除某些文件或目录之前的其他规则:
RewriteEngine On
# Folders / files to exclude from rewrite divided by Pipe goes here:
RewriteRule (^|/)web(/|$) - [L,NC]
# turn empty requests into requests for "index.php",
# keeping the query string intact
RewriteRule ^$ index.php [QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !favicon.ico$
RewriteRule ^(.*)$ index.php [QSA,L]