.htaccess redirect domain alias / parked domain

前端 未结 1 1407
-上瘾入骨i
-上瘾入骨i 2021-01-07 04:51

I have a .htaccess related question.

For example, if I have two domain, a.com and b.com. All referring to one host (b.com is domain alias of a.com). I want visitor t

1条回答
  •  滥情空心
    2021-01-07 05:04

    You could try with 2 rewrite rules

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

    0 讨论(0)
提交回复
热议问题