开发者

Redirection rule in apache with subDomain?

开发者 https://www.devze.com 2023-01-25 23:03 出处:网络
greetings all, i have multi sub-domain on my domainname.com , i need to redirect www.*.domainname.com to

greetings all, i have multi sub-domain on my domainname.com , i need to redirect www.*.domainname.com to *.domainname.com

ex: http://www.sub1.domainname.com to http://sub1.domainname.com

any i开发者_开发知识库deas how to do so ?


Try this, and see does this help

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

Or try this for dynamic subdomain

RewriteCond  %{HTTP_HOST}  ^www.(.*).domainname.com
RewriteRule ^/(.*)         http://%1.domainname.com/$1 [L,R=301]
0

精彩评论

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