Redirect to HTTP non-www to HTTPS www htaccess

前端 未结 12 1131
醉话见心
醉话见心 2020-12-01 08:05

I want to redirect from any direction to our site with HTTPS protocol, but some redirects it\'s not working. I want this:

  • http://www.site.co TO
12条回答
  •  心在旅途
    2020-12-01 08:52

    In case you are using One.com as your webhost you should use the following code instead:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

提交回复
热议问题