Olivier Bossel
Olivier Bossel

Reputation: 33

.htaccess : if is an path, do nothing, else, do the rewriterule

I have a little question very simple this time I think... How Have I to write my htaccess to do this instructions :

IF IS "/uploads" PATH INTO MY REQUEST, NOT REDIRECT AT ALL, JUST DO THE REGULAR REQUEST ELSE DO THE REWRITERULE : RewriteRule (.*) http://theDestinationDomain.com/$1 [P,L]

I Have tested that :

RewriteEngine on
RewriteCond %{REQUST_URI} !^/uploads/(.*)
RewriteCond %{HTTP_HOST} theDomainThatWillBeRedirect.com
RewriteRule (.*) http://theDestinationDomain.com/$1 [P,L]

That Just don't work... That make always the redirection to theDestinationDomaine.com/...

Any idea ?

Thanks a lot !

See you

Olivier

Upvotes: 3

Views: 4604

Answers (1)

fuxia
fuxia

Reputation: 63576

Note the extra E. :)

RewriteCond %{REQUEST_URI} !/uploads/
RewriteCond %{HTTP_HOST} theDomainThatWillBeRedirect.com
RewriteRule (.*) http://theDestinationDomain.com/$1 [L,R=301]

Upvotes: 5

Related Questions