Redirect subdomain page to top level domain page

Discussion in 'Apache' started by hoshheid, Apr 13, 2009.

  1. #1
    Hi

    I need to use .htaccess rules to redirect all subdomain pages to their domain pages.

    Ie.

    subdomain.domain.com/page1.html > domain.com/page1.html

    subdomain.domain.com/page3.html > domain.com/page3.html

    etc

    Can anyone help out?

    Thanks
     
    hoshheid, Apr 13, 2009 IP
  2. mascix

    mascix Active Member

    Messages:
    64
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    93
    #2
    rewritecond %{http_host} ^subdomain.domain.com [nc]
    rewriterule ^(.*)$ http://domain.com/$1 [r=301,nc]

    I am not sure I have not tried it yet but that would help
     
    mascix, Apr 13, 2009 IP