Samuli Viitasaari
Samuli Viitasaari

Reputation: 635

.htaccess RewriteCond – adding multiple exceptions

My question is very simple, but I want to get it absolutely right the first try, because I'm working on a live website and bad things could happen if I blew this :)

So, as a part of a RewriteRule that forwards all my regular visitors to /myfolder/, there is an important line preventing the rule from being applied if you're already in that folder:

RewriteCond %{REQUEST_URI} !^/myfolder/

That works fine. What I want is to add my dev folder to that exception, so myself and my clients can access my development projects while all other URI's still get forwarded to /myfolder/

I'm guessing I need to modify the RewriteCond along the lines of:

RewriteCond %{REQUEST_URI} !^/myfolder/ 

(here I basically need 'OR' in the right syntax) !^/dev/

What's the correct syntax for this?

Upvotes: 2

Views: 1636

Answers (1)

anubhava
anubhava

Reputation: 784898

You can actually use this condition:

RewriteCond %{REQUEST_URI} !^/(myfolder|dev)/ [NC]

Upvotes: 1

Related Questions