.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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -