https:// www。版本未重定向到我的网站上的https://

时间:2019-04-16 14:40:58

标签: apache ssl redirect ssl-certificate

我已经在Godaddy CPanel上进行了托管,并且我的网站https://example.com/运行正常,但是如果我在浏览器中输入https://www.example.com,则会得到一个空白页面(没有重定向,并且https仍然显示工作)。这几乎像WSOD。查看我的.htaccess文件,似乎使用SSL为Wordpress网站正确设置了所有内容。

这是我的代码:

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^example\.com$ [OR]
RewriteCond %{SERVER_NAME} ^www\.example\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress 

我希望在不中断站点的情况下将www版本重定向到非www版本。我目前拥有的.htaccess规则有问题吗?

0 个答案:

没有答案