我已经对我的WordPress网站的htaccess文件进行了修改,将流量从http重定向到https。
大多数情况下,它工作得很好,并将流量重定向到https,但有些情况下它没有。
例如,如果我试图访问地址为http的主页,它会重定向到https,但如果我试图访问网站上另一个网址为http的页面,它就会停留在http。
当前 htaccess。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
</IfModule>
# END WordPress
我已经尝试了其他问题中的许多答案,我还可以尝试什么?
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>