简体   繁体   中英

excluding folder and block other folders

How to block all folders in specific folder 'inc' and exclude two folders in expression

for example i have structure

/inc/privateA/...
/inc/privateB/...
/inc/privateC/...
/inc/privateD/...
/inc/publicA/...
/inc/publicB/...

my attempts

RewriteRule ^inc/!(publicA|publicB)/ / [R=301,L]

You can use negative lookahead for this:

RewriteRule ^inc/(?!(?:publicA|publicB)/) / [R=301,L,NC]

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