Here is the simple mod_rewrite rule that will help you redirect your site URL to another domain with exception. Assuming we have a domain named "foo.example.com" and we want to redirect all our site traffic to an external domain "bar.example.com" with an exception that our /admin/ directory should not redirect, we can use the following in htaccess :
RewriteEngine on RewriteRule !admin https://bar.example.com [L,R=301]
See the full article on this page : https://helponnet.com/2021/05/01/redirect-domain-with-exception/
Top comments (0)