301 redirect old domain to homepage

Discussion in 'Search Engine Optimization' started by ridesign, Jan 1, 2007.

  1. #1
    I have an old domain which I want to forward all the pages from the old domain to the hompage of the new domain, is there a way to do this?

    I am using .htaccess

    redirect 301 / http://www.newdomain.com/

    but if there is pagex.html it redirects to: http://www.newdomain.com/pagex.html but I would like it to go directly to the homepage, is there a way to do this?

    thanks
     
    ridesign, Jan 1, 2007 IP
  2. ridesign

    ridesign Peon

    Messages:
    294
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can anyone help me?
     
    ridesign, Jan 2, 2007 IP
  3. jmaresca2006

    jmaresca2006 Peon

    Messages:
    302
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #3
    jmaresca2006, Jan 2, 2007 IP
  4. ridesign

    ridesign Peon

    Messages:
    294
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what would I do on the webserver?

    thanks
     
    ridesign, Jan 3, 2007 IP
  5. T-Shirt Gal

    T-Shirt Gal Peon

    Messages:
    52
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you have mod_rewrite enabled you can do this:

    RewriteCond %{HTTP_HOST} ^www\.oldwebsite\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^oldwebsite\.com$
    RewriteRule ^(.*)$ http://www.newwebsite.com/ [R=301,L]
     
    T-Shirt Gal, Jan 3, 2007 IP