redirecting all subdomains to main domain
2 posts
• Page 1 of 1
redirecting all subdomains to main domain
I would like to redirect all the subdomains to main domain.
i.e
abc.example.com should be redirected to example.com
similarly
xyz..example.com should also be redirected to example.com
i.e
abc.example.com should be redirected to example.com
similarly
xyz..example.com should also be redirected to example.com
Re: redirecting all subdomains to main domain
Hello,
It should look like this:
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\..*)(.+)\.example\.com$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
It should look like this:
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\..*)(.+)\.example\.com$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests