且构网

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

重定向HTTP,HTTPS:// WWW到https://domain.com使用的.htaccess

更新时间:2023-02-26 09:11:18

的.htaccess 文件试试这个:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} !on
RewriteRule ^ https://domain.com/%{REQUEST_URI} [R=302,L]

第一个条件检查 WWW的presence。和第二个条件检查,如果HTTPS是关闭当前请求。重定向将触发这两个条件得到满足的

The first condition checks for the presence of www. and the second condition checks if HTTPS is off for the current request. The redirect will trigger of either of these conditions are met.

在未来,请发表你试过code。欲了解更多信息,请参阅帮助中心:帮助中心>问>在主题