regex - Htaccess : https for all except specific domains -
i have following rules redirect request https://www.mainsite.com
rewriterule .* https://%{http_host}%{request_uri} [l,r=301] rewritecond %{http_host} !^www\. rewriterule .* https://www.%{http_host}%{request_uri} [l,r=301]
now want redirect http://another-domain.com
specific folder (blog) without https
added this.
rewriteengine on rewritecond %{http_host} ^(www.)?another-domain.com$ [nc] rewritecond %{request_uri} !^/blog/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /blog/$1 rewritecond %{http_host} ^(www.)?another-domain$ [nc] rewriterule ^(/)?$ blog/index.php [l]
even http://another-domain.com
still redirected https://www.mainsite.com
have way:
rewriteengine on rewritecond %{http_host} !^www\. [nc,or] rewritecond %{https} off rewritecond %{http_host} ^(?!(www\.)?another-domain\.com$)(?:www\.)?(.+)$ [nc] rewriterule ^ https://www.%1%{request_uri} [r=302,l,ne] rewritecond %{http_host} ^(www\.)?another-domain\.com$ [nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^((?!blog/).+)$ blog/$1 [l] rewritecond %{http_host} ^(www\.)?another-domain\.com$ [nc] rewriterule ^/?$ blog/index.php [l]
Comments
Post a Comment