regex - How to force HTTPS to subdomain (no www) -


how can force user following url while forcing https?

https://subdomain.hostname.com/request-uri

from of these links:

http://hostname.com/request-uri

http://www.hostname.com/request-uri

https://hostname.com/request-uri

https://www.hostname.com/request-uri

i tried:

rewriteengine on rewriterule .* https://subdomain.hostname.com%{request_uri} [l,r=301] 

and:

rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?hostname\.com$ rewritecond %{https} off rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301] 

without having success...

you can use :

rewriteengine on rewritebase / rewritecond %{http_host} ^(?:www\.)?hostname\.com$ rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301] 

clear browser cache before testing this.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -