.htaccess - redirect multiple domains to another domain except 1 directory using htaccess -
i trying redirect multiple domains single domain (which working fine) want 1 directory not redirect or change main domain url.
here .htaccess code works fine until here
this 1 working
rewritecond %{http_host} ^http(s)?://(www.)?domain.com$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.net$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.org$ [or] rewritecond %{http_host} ^domain.info$ [or] rewritecond %{http_host} !^www.domain.info rewriterule (.*) http://www.domain.info/$1 [r=301,l]
but when try stop redirect of 1 specific directory by
full code
rewritecond %{http_host} ^http(s)?://(www.)?domain.com$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.net$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.org$ [or] rewritecond %{http_host} ^domain.info$ [or] rewritecond %{http_host} !^www.domain.info [or] rewritecond %{request_uri} !^/no_redirect_dir/ rewriterule (.*) http://www.domain.info/$1 [r=301,l]
it stops working :( error page not redirecting correctly.
extra code causing error
rewritecond %{http_host} !^www.domain.info [or] rewritecond %{request_uri} !^/no_redirect_dir/
any highly appreciated.
thank you!
write .htaccess this:
rewritecond %{http_host} (www\.)?domain\.(org|net|com)$ [nc] rewritecond %{request_uri} !^/*no_redirect_dir/ [nc] rewriterule ^(.*)$ http://www.domain.info/$1 [r=301,l]
http_host variable has domain name, no http/https information.
Comments
Post a Comment