我有域hubket.com,我通过godaddy启用了https。现在它正确启用了https,如果你打开它。
现在,我想为所有用户转换为www或无www,例如http://www.hubket.com
我尝试在这样的教程中启用少量测试代码!
测试1
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
测试2
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
请帮助我为所有用户打开https。
感谢
答案 0 :(得分:1)
试试这个,无需进行更改(如网址):
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
除了这个htaccess代码段之外,您必须使用https://搜索并替换数据库中的所有http://链接。为此,我可以向您推荐this script。
答案 1 :(得分:0)
您可以尝试以下操作:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^hubket\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.hubket.com/$1 [R,L]
答案 2 :(得分:0)
试试这个
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
确保将example.com替换为域名