Answer the question
In order to leave comments, you need to log in
How to make an exception for one directory in HTACCESS?
Good afternoon, there is a task to make a redirect from one domain to another for all pages except for one directory like oldsite.ru/directory.
This solution completely redirects all requests to another domain:
RewriteCond %{HTTP_HOST} oldsite.ru
RewriteRule (.*) https://newsite.ru [R=301,L]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{HTTP_HOST} oldsite\.ru
RewriteCond %{REQUEST_URI} !^/directory(/|)
RewriteRule (.*) https://newsite.ru [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question