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,087
    Likes Received:
    1,971
    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 Supreme Member

    Joined:
    Jan 24, 2010
    Messages:
    1,224
    Likes Received:
    751
    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,087
    Likes Received:
    1,971
    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,087
    Likes Received:
    1,971
    Location:
    Boston, MA
    bump, any ideas?
     
    • Thanks Thanks x 1
  6. davids355

    davids355 Moderator Staff Member Moderator Jr. VIP

    Joined:
    Apr 25, 2011
    Messages:
    12,301
    Likes Received:
    10,337
    Location:
    Scotland
    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,087
    Likes Received:
    1,971
    Location:
    Boston, MA
    Thank you!!! :) Gotta wait a bit to give rep to you again
     
    • Thanks Thanks x 1
  8. davids355

    davids355 Moderator Staff Member Moderator Jr. VIP

    Joined:
    Apr 25, 2011
    Messages:
    12,301
    Likes Received:
    10,337
    Location:
    Scotland
    Home Page:
    No problem.