开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜