.htaccess - How to avoid redirect from subdomain in htaccess file? -
i using in htaccess:
rewriteengine on rewritecond %{http_host} ^example.com [nc] rewriterule ^(.*)$ https://www.example.com/$1 [l,r=301] rewritecond %{https} !=on rewriterule ^ https://%{http_host}%{request_uri} [l,r=301]
but has unfortunate effect of redirecting every call mobile site (m.example.com) main page. how make exception m.example.com? don't know how setup rewriterule correctly.
you can use:
rewriteengine on rewritecond %{http_host} ^example\.com$ [nc] rewriterule ^ https://www.%{http_host}%{request_uri} [ne,l,r=301] rewritecond %{https} !=on rewritecond %{http_host} !^m\. [nc] rewriterule ^ https://%{http_host}%{request_uri} [l,r=301,ne]
and make sure clear browser cache.
Comments
Post a Comment