如何在下面重写此规则,以便忽略某些文件夹以及这些文件夹中的所有内容。
# BEGIN WishList Member Attachment Protection
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|bmp)$
RewriteRule ^(.*)$ /index.php?wlmfile=$1 [L]
# END WishList Member Attachment Protection
我认为在当前的重写之上添加一行就可以了,但它看起来并不像......
RewriteCond %{REQUEST_URI} !^/foldertoignore
RewriteCond %{REQUEST_URI} !^/foldertoignorenumber2
以下没有工作:
# BEGIN WishList Member Attachment Protection
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/foldertoignore
RewriteCond %{REQUEST_URI} !^/foldertoignorenumber2
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|bmp)$
RewriteRule ^(.*)$ /index.php?wlmfile=$1 [L]
# END WishList Member Attachment Protection
答案 0 :(得分:2)
不确定为什么它不起作用。但是你应该能够以这种方式规则。
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(folder1|folder2)/?(.*)$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|bmp)$
RewriteRule ^(.*)$ /index.php?wlmfile=$1 [L]
你也可以这样试试规则。如果它匹配那些目录什么也不做。
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(folder1|folder2)/?(.*)$ [NC]
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|bmp)$
RewriteRule ^(.*)$ /index.php?wlmfile=$1 [L]
另外请务必清除浏览器缓存以防万一。