.htaccess - Disable rewrite to https for subdomains -


i use rewrite https of calls of .htaccess file.

i want avoid http://foo.myhost.com gets rewritten https://www.myhost.com

it should stay

http://foo.myhost.com <-note, not https

<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] </ifmodule> 

add negated condition avoid matching subdomain:

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

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -