2015-03-19 118 views
1

我无法让我的WordPress网站在最初加载时没有www和https://而不是http://。在加载网站时添加www的URL,而不是https://

我将WordPress固定链接设置为“发布名称”,因此该链接看起来像“https://example.com/sample-post”。我还将“WordPress地址(URL)”和“站点地址(URL)”更改为“https://example.com”。

我已将此添加到WP-config.php文件:

define('FORCE_SSL_ADMIN', true); 

没有什么工作。

有一件事我做那种工作是添加此为.htaccess:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] 
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] 
</IfModule> 

# 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.example.com,然后3秒后它更改为https://example.com。这似乎是一个奇怪的黑客。

我错过了什么?我怎么有我的网站最初以https正常加载://

回答

0

添加到您的.htaccess文件

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L] 
+0

我想从谷歌点击链接时,这将只适用。在地址栏中输入example.com时,它会变成www.example.com。内部链接转到https:// example.com,但我试图让页面加载的网站转到https:// example.com。 – steeped 2015-03-19 14:14:04

+0

编辑我的答案,以满足您的需求。希望这可以帮助。 – Holdfast33 2015-03-19 14:17:35

+0

哪里应该添加?我在我的htaccess文件中已经有类似的东西。我用原来的文章写出来了。 – steeped 2015-03-19 14:31:55