.htaccess redirect subdomains to home page

furfing

New member
Sep 12, 2008
607
3
0
N/A
Hello,

let's say i purchase an expired domain with smth like X00 hundreds of subdomains.

I'd like them all redirected to the home page even i dont know what they are.

Is there any .httaccess rule that can make that ?

Thx
 


Code:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

This will direct any subdomain other than www to www.,

If you want them to go to the index only, remove the $1 from the 2nd line.
 
I understood you fine, the code above still stands :)
 
Code:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
This will direct any subdomain other than www to www.,

If you want them to go to the index only, remove the $1 from the 2nd line.

hi! thank you this, i might also need it.