2016-07-30 12 views
-1

だから、htaccessを介して、httpsにすべてを強制的に私が持っている:Wordpressのサイトのための私のhtaccessファイルに

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
</IfModule> 

Iたくhttps://example.comに行くに入力されたものは何でもすべてのURL

で(HTTPS、無WWW。)これはここにも働く瞬間:ページ上では動作しません。しかし

http://example.com = https://example.com 
www.example.com = https://example.com 

http://example.com/page/ = example.com/page/ 
www.example.com/page/ = example.com/page/ 

これをhttpsバージョンにするにはどうすればよいですか?

答えて

0

あなたのhtaccessファイルを以下に変更してください。それはうまくいくでしょう。

を使用でき
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/ [L,R=301] 
RewriteCond %{HTTP_HOST} ^www\.example\.com$ 
RewriteRule ^$ https://example.com/? [L,R=301] 
</IfModule> 
+0

まだ動作していません:http://domain.com/page/ = domain.com/page/ www.domain.com/page/ = domain.com/page/ – Mikey2004

0

RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] 
RewriteRule^https://%1%{REQUEST_URI} [NE,L,R=301] 
RewriteCond %{HTTPS} off 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301] 
0

あなたの.htaccessでこれを使用して試すことができます:

RewriteEngine on 
RewriteBase/

RewriteCond %{HTTPS} !=on [OR] 
RewriteCond %{HTTP_HOST} ^www\. 
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [NE,L,R=301] 
0

これはトリックを行っているようだ...

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{SERVER_PORT} !^443$ 
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 
+0

www?そうは思わない。 – Croises

+0

仕事をしているようです... – Mikey2004

関連する問題