Redirect to HTTP non-www to HTTPS www htaccess

前端 未结 12 1135
醉话见心
醉话见心 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:56

    Just put the following in the .htaccess file

     RewriteEngine on
    
     RewriteCond %{SERVER_PORT} 80 
     RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    

提交回复
热议问题