且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用的.htaccess重定向到http://www.domain.com https://www.domain.com

更新时间:2023-02-26 09:24:01

它将为PHP的所有版本工作,将迫使SSL和WWW所有裸域和链接:

It will work for ALL versions of php and will force SSL and www to all naked domains and links:

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]


  • 我们确实需要NE

  • WWW。是可选的在第4行

  • 关闭必须是。

  • 玩得开心。

    本杰明