2016-06-21 12 views
2

htaccess http to https with www. Without redirecting sub domainのようなスタックオーバーフローには多くの同様の解決策があります。.htaccess HTTPSメインドメインとワイルドカードHTTPサブドメイン+すべて非WWW

は私が必要なもの、しかし、次のとおりです。

  • メインドメインのHTTPS + NON-WWW
  • ワイルドカードHTTPではなく次々と追加のすべてのサブドメインのために。

私はWordPress Multisiteウェブサイトを実行しており、ワイルドカードSSLはありません。

非WWW

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

非WWWと非HTTPSサブドメイン

RewriteEngine On 
    RewriteCond %{HTTPS} off 

    RewriteCond %{HTTP_HOST} !=subdomain1.main.com 
    RewriteCond %{HTTP_HOST} !=subdomain2.main.com 
    RewriteCond %{HTTP_HOST} !=subdomain3.main.com 
    RewriteCond %{HTTP_HOST} !=subdomain4.main.com 

SSL:私は、現時点では以下を使用しています

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

答えて

1

これは必要なものですか?

RewriteEngine On 
RewriteBase/

# www is redirected to base domain 
RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$ 
RewriteRule ^(.*)$ https://%1/$1 [L,R=301] 

# base domain should use HTTPS 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^[^\.]+\.[^\.]+$ 
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301] 

# other domain should use HTTP 
RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} !^[^\.]+\.[^\.]+$ 
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301] 
+0

こんにちはフロリアン、ありがとう!いいえ、残念ながらうまくいきません。私が追加する瞬間、WWWは削除されてもすべてHTTPSになります。 –

+0

上記のコメントにあなたをタグするのを忘れてしまった。 –

関連する問題