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

301 redirecting only homepage, not subpages? Why?

Discussion in 'Black Hat SEO' started by Jared255, Dec 10, 2011.

  1. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,004
    Likes Received:
    1,891
    Location:
    Boston, MA
    I'm trying to 301 an old domain to a new domain.

    This is the code I'm putting in .htaccess:

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://newdomain.com/$1 [R=301,L]
    However, that is only redirecting http://domain.com to the new domain, not any subpages like http://domain.com/contact.php. Google is still indexing http://domain.com/anysubpage.php.

    Any ideas as to why this is happening?

    Thanks,

    Jared
     
    • Thanks Thanks x 1
  2. ravetildon

    ravetildon Registered Member

    Joined:
    Jan 28, 2009
    Messages:
    70
    Likes Received:
    12
    how do u want to do it?
    a.com = b.com
    a.com/apage.html = b.com/apage.html

    or

    a.com = b.com
    a.com/apage.html = b.com
     
  3. volund

    volund Senior Member

    Joined:
    Jan 24, 2010
    Messages:
    1,159
    Likes Received:
    729
    Occupation:
    Trying to make a buck or two
    Try this

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} \olddomain.com$
    RewriteRule (.*) http://www.yournewdomain.com/$1 [R=301,L]
     
    • Thanks Thanks x 1
  4. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,004
    Likes Received:
    1,891
    Location:
    Boston, MA
    Looking to make every page from a.com redirect to the homepage of b.com. So the second option.

    Didn't work unfortunately :(
     
  5. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,004
    Likes Received:
    1,891
    Location:
    Boston, MA
    bump, any ideas?
     
    • Thanks Thanks x 1
  6. davids355

    davids355 Jr. VIP Jr. VIP

    Joined:
    Apr 25, 2011
    Messages:
    9,710
    Likes Received:
    7,241
    Home Page:
    Try:

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule  (.*)$    http://newdomain.com [R=301,L]
    tested and works my end.

     
    • Thanks Thanks x 1
  7. Jared255

    Jared255 Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,004
    Likes Received:
    1,891
    Location:
    Boston, MA
    Thank you!!! :) Gotta wait a bit to give rep to you again
     
    • Thanks Thanks x 1
  8. davids355

    davids355 Jr. VIP Jr. VIP

    Joined:
    Apr 25, 2011
    Messages:
    9,710
    Likes Received:
    7,241
    Home Page:
    No problem.