![](/img/trans.png)
[英]How to redirect one domain to another, non-www to www, and enforce SSL with .htaccess file
[英]Using www and non-www domain with one SSL certificate
我想為www和非www流量使用一個SSL證書。 因此,我想將所有流量從www重定向到非www。 (證書適用於非www)。
以下規則從非www重定向到www。 但是我需要對面。 https://www.example.com到https://example.com
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
謝謝
如果您已經知道域名,那么應該可以:
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.