Sławomir Kudła
Sławomir Kudła

Reputation: 291

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]

Upvotes: 1

Views: 32

Answers (1)

anubhava
anubhava

Reputation: 785276

You can use negative lookahead for this:

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

Upvotes: 2

Related Questions