Jeff
Jeff

Reputation: 35

.htaccess directory exception

Right now, my current .htaccess in my root directory looks like this;

RewriteEngine on
RewriteRule !^Email-Blasts($|/) http://example.com/store/%{REQUEST_URI} [R=301]

RewriteCond %{REQUEST_URI} !/store/$
RewriteRule (.*) /store/ [R=301,L]

I am looking for any going to example.com/ to goto example.com/store/ but allow access to /email-blasts/ so the images and files within that directory work as well. Is this the correct way to go about it? Because it sure doesn't seem like it's working!

Thanks for the help!

Upvotes: 2

Views: 58

Answers (1)

anubhava
anubhava

Reputation: 785286

Replace your rule with this:

RewriteEngine on

RewriteCond %{REQUEST_URI} !/(store|Email-Blasts)/ [NC]
RewriteRule ^(.*)$ /store/$1 [R=301,L]

Upvotes: 1

Related Questions