【问题标题】:htaccess redirect 1 domain to http, others to https. all for non-wwwhtaccess 将 1 个域重定向到 http,将其他域重定向到 https。一切为了非www
【发布时间】:2016-08-12 06:57:06
【问题描述】:

我使用 htaccess 加载 Magento 网站。 问题是我有 1 个没有 SSL 的域,是否可以仅将这 1 个域重定向到 http,而其他任何域都将重定向到 https。所有域都应指向非 www 版本。

我目前的 htaac​​ces:

    Options +SymLinksIfOwnerMatch
    RewriteEngine on

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

RewriteCond %{HTTP_HOST} .*abc\.com [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:abc]
RewriteCond %{HTTP_HOST} .*abc\.com [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]

RewriteCond %{HTTP_HOST} .*qwe\.de [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:qwe]
RewriteCond %{HTTP_HOST} .*qwe\.pl [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]

RewriteCond %{HTTP_HOST} .*zxc\.fr [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:zxc]
RewriteCond %{HTTP_HOST} .*zxc\.fr [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]

我喜欢将 qwe.de 重定向到 http。而任何其他域都应该指向 https。

【问题讨论】:

    标签: apache .htaccess magento redirect mod-rewrite


    【解决方案1】:

    这是 htaccess 的问题,不是 magento 的问题

    试试这个

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^metrikstudios\.com [NC]
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
    

    【讨论】:

    • 嗨,问题是关于从 https 重定向到 http。你用相反的东西回答。
    猜你喜欢
    • 2015-05-19
    • 1970-01-01
    • 2017-11-03
    • 1970-01-01
    • 2021-04-23
    • 2018-06-02
    • 1970-01-01
    • 1970-01-01
    • 2020-05-27
    相关资源
    最近更新 更多