Wordpress .htaccess将http/https www重定向到https非www
我正在谷歌云上的wordpress网站上疯狂地尝试重定向所有内容,例如。到 我目前正在使用以下内容,这在示例中是最容易转移注意力的:Wordpress .htaccess将http/https www重定向到https非www,wordpress,.htaccess,redirect,https,Wordpress,.htaccess,Redirect,Https,我正在谷歌云上的wordpress网站上疯狂地尝试重定向所有内容,例如。到 我目前正在使用以下内容,这在示例中是最容易转移注意力的: RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache) RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] RewriteCon
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
它指导以下链接:;到
但它不会使用重新定向链接
任何帮助都将不胜感激 您可以使用:
RewriteEngine on
# www -> https without www
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R=301]
# http -> https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !wp-content/cache/(all|wpfc-mobile-cache)
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
试试看,它应该也能用。。这就是将所有“http”请求重定向到“https”所需的全部内容,但请注意,您仍然需要在站点上安装有效的SSL证书
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]