2016-10-25 21 views

答えて

0

1つの方法は、DNSプロバイダにリダイレクトを依頼することです。

別の方法は、この他のstackoverflowの質問で説明します:.htaccess - how to force "www." in a generic way? 基本的には、以下の作業をする必要があります:

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

+0

を試してみてください。私たちはDNSレベルで行うことはできません。私のサイトではAWSロードバランサを実行しています。 – Raj

+0

私は試しましたが、動作しません。 – Raj

+0

私の例は 'http'アドレスです。それを 'https'に変更してみてください。 – spitterfly

0

のhttp非WWWからサイトをリダイレクトするにhttps://wwwに次のルールを使用することができます

RewriteEngine on 

RewriteCond %{HTTP_HOST} !^www\. 
RewriteCond %{HTTPS} off 
RewriteRule^https://www.example.com%{REQUEST_URI} [NE,L,R] 
+0

https://example.comをhttps://www.example.comにリダイレクトする必要があります。 – Raj

+0

その動作していない – Raj

+0

その動作しない:( – Raj

0

ウェブサイトとしてApacheを使用している場合は、エイリアス

<VirtualHost *:443> 
    ServerName www.example.com 
    ServerAlias example.com 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/devops_blog 
    <Directory /var/www/devops_blog> 
     Options All 
     AllowOverride All 
     Require all granted 
    </Directory> 
0

我々はroute53を使用しているこの

RewriteEngine on 
RewriteCond %{HTTPS_HOST} ^example\.com$ [NC] 
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] 
関連する問題

 関連する問題