.htaccess - Redirect to HTTP non-www to HTTPS www htaccess -


i want redirect direction our site https protocol, redirects it's not working. want this:

  • http://www.site.co https://www.site.co
  • http://site.co https://www.site.co

this htaccess:

rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://www.domain.com/$1 [l,r=301]   rewritecond %{http_host} !^www\. rewriterule ^(.*)$ https://www.domain.com/$1 [l,r=301] 

the second rule it's not working. going direction inside our site, , isn't redirect https site.

try this:

rewriteengine on  rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [l,r=301]  rewritecond %{https} off rewriterule ^(.*)$ https://www.domain.com/$1 [l,r=301]  

the real difference here first redirect non-www www check https , redirect it.

if work try one:

rewriteengine on  rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [l,r=301]  rewritecond %{server_port} !^443$ rewriterule ^(.*)$ https://www.domain.com/$1 [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? -