regex - Redirect http to https for only www root and not subdirectories -


i trying redirect website https. used

rewriteengine on rewritecond %{https} !on rewriterule (.*) https://%{http_host}%{request_uri} 

i have www.example.com.au , these redirected fine; however, have mobile.example.com.au don't want redirect. how can redirect 1 without other?

just add condition allow rule main domain only:

rewriteengine on  rewritecond %{http_host} ^(www\.)?example\.com\.au$ [nc] rewritecond %{https} !on rewriterule ^ https://%{http_host}%{request_uri} [l,r=301] 

Comments