apache - htaccess http to https with www. Without redirecting sub domain -


i have rewriterule redirects main domain https://www.sta-games.com works fine, when try access subdomain http://files.sta-games.com, redirects main domain.

heres redirect rules

#https redirection rewritecond %{https} off  rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301]  rewritecond %{http_host} !^www\. rewriterule ^(.*)$ https://www.%{http_host}%{request_uri} [l,r=301] 

can see problem?

you need adjust rules looks whole domain instead of part of it. right looking absence of www. why subdomain redirects.

first need combine rules because seems want redirect if https not on , there no www, make 1 rule. use actual domain name in rule. replace example.com domain. should fix issue.

#https redirection rewritecond %{https} off [or] rewritecond %{http_host} !^(www\.)?example\.com rewriterule ^(.*)$ https://www.example.com%{request_uri} [l,r=301] 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -