简体   繁体   中英

htaccess rewrite rule except folder

I have this rule in my htaccess

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule !\.(js|ico|gif|jpg|png|bmp|swf|css|html)$ public/index.php [QSA,L]

And now I want to add one or two exception folder. Can anyone help? Really appreciate.

You can add a new RewriteCond for creating exceptions for 2 folders:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/(folder1|folder2)/ [NC]
RewriteRule !\.(js|ico|gif|jpg|png|bmp|swf|css|html)$ public/index.php [NC,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM