开发者

create subdomain address of subdomain that does not exist, to redirect to the main domain

开发者 https://www.devze.com 2022-12-18 16:51 出处:网络
Would it be pos开发者_Python百科sible to set a 301 redirect for sub.domain.com to redirect to domain.com/directory

Would it be pos开发者_Python百科sible to set a 301 redirect for

sub.domain.com to redirect to domain.com/directory

even when the subdomain does not exist.


<IfModule mod_rewrite.c>
RewriteEngine On

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

</IfModule>

This will redirect sub1.domain.com to www.domain.com/sub1. Replace domain.com with your address, and enumerate the subdomains you want to redirect using | as separator

0

精彩评论

暂无评论...
验证码 换一张
取 消