htaccess redirect subdomain to root domain

后端 未结 2 1160
無奈伤痛
無奈伤痛 2021-01-18 08:00

I want to redirect this subdomain:

http://abc.domain-name.com

to a folder on the root domain that uses the same name:

http:         


        
2条回答
  •  礼貌的吻别
    2021-01-18 08:42

    You should consider about search engines and use permanent redirect (301), also its best practice to use NC flag at the end if second line to be matched in a case-insensitive manner.

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

提交回复
热议问题