【发布时间】:2018-07-03 10:12:53
【问题描述】:
我有一个从所有域到 https://example.de 的 301 重定向。 重定向适用于http://www.example,www.example 使用所有 tld (.com,.eu.net)。 但是对于https://www.example,它不会在没有 www 的情况下重定向到 https。 这是Mod重写:
RewriteEngine on
RewriteCond %{HTTPS} =off
RewriteCond %{HTTP_HOST} ^www\.example\.de$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.de$ [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.at$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.at$ [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.eu$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.eu$ [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.net$ [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.org$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.org$ [NC]
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ https://example.de/$1 [R=301,L]
编辑: 到目前为止,以下工作
RewriteCond %{HTTPS} on [NC]
RewriteCond %{HTTP_HOST} !^example\.de$ [NC]
RewriteRule ^(.*)$ https://example.de/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteBase /
RewriteRule ^(.*)$ https://example.de/$1 [R=301,L]
【问题讨论】:
-
投反对票,没有答案,我爱这个社区....
标签: .htaccess redirect mod-rewrite