2016-03-31 21 views
0

私のウェブサイトはhttps://example.comからhttps://www.example.comにリダイレクトしたいと思います。コードを.htaccessファイルに置くことができますか?サイトはmagentoです。non.www to httpsからwww.httpsへの書き換えルール.htacces magento

+0

可能な複製(http://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www) –

+0

私はStack Overflowは[プログラミング関連](http://stackoverflow.com/help/on-topic)のQ&Aサイトであるため、この質問を議論の対象外としています。あなたの質問はプログラミングに関するものではありません。おそらくあなたは代わりにhttp://magento.stackexchange.comに投稿する必要がありますか? – Enigmativity

答えて

0
RewriteCond %{HTTP_HOST} !^www. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] 

を説明:要求されたホストは、WWWで起動しない場合は、WWWで

+0

ありがとうございますが、私はHTTPS用のコードが必要です.. wwwなしでwwwへリダイレクトwww –

+0

これはhttpsのコードですか? – Garytje

0

ソースを開始するためにそれをリダイレクト|参考:http://codingbasics.net/magento-htaccess-file-optimized-speed-security-seo/

を上記のリンクを持つデフォルトMagentoののhtaccessファイルを持っていますスピードとSEOのために最適化されており、非wwwをwwwに書き換えるコードがありますが、www以外のHTTPS/SSLをwwwに書き換えるコードはありません。だから私は上のリンク/サイトからhtaccessのコードセクションをつかんで、http:// www以外のHTTPS/SSLを書き直すために、以下のコードを編集しました。

##### Search Engine redirects and rewrites for SEO purposes ##### 

<IfModule mod_rewrite.c> 
    # Rewrite|Redirect http to https|SSL & non-www to www 
    RewriteCond %{HTTPS} !=on 
    RewriteCond %{SERVER_PORT} ^80 
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC] 
    RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R,L] 

    ##### Redirect away from /index.php and /home 
    ##### Warning: This index.php rewrite will prevent Magento 
    ##### Connect from working. Simply comment out the 
    ##### following two lines of code when using Connect. 
    ##### Please note - https://www. if not using www simply use https:// 

    RewriteCond %{THE_REQUEST} ^.*/index.php 
    RewriteRule ^(.*)index.php$ https://www.yourdomain.com/$1 [R=301,L] 

    ##### Please note - https://www. if not using www simply use https:// 
    redirect 301 /home https://www.yourdomain.com 

    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-l 
    RewriteRule .* index.php [L] 
</IfModule> 
[非WWWへのジェネリックのhtaccessリダイレクトWWW]の
関連する問題