1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[ASK] How to redirect catchall subdomains to main domain on a shared hostgator hosting

Discussion in 'Black Hat SEO' started by imserious, Jul 25, 2011.

  1. imserious

    imserious Senior Member

    Joined:
    Mar 27, 2009
    Messages:
    946
    Likes Received:
    560
    i want to redirect all the subdomains whether they exist or not to the main domain on a shared hosting account. Is there a way to do it using .htaccess

    Modifying A records requires dedicated IP..

    Pls help..

    Mods - Pls move if posted in the wrong section..
     
  2. imserious

    imserious Senior Member

    Joined:
    Mar 27, 2009
    Messages:
    946
    Likes Received:
    560
    Bump Pls..
     
  3. other_henry

    other_henry Junior Member

    Joined:
    Jun 1, 2011
    Messages:
    107
    Likes Received:
    19
    Occupation:
    Freelance coder, server guy
    Location:
    US
    This should do the trick:

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