301 redirecting only homepage, not subpages? Why?

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

  1. Total Noob

    Total Noob Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,129
    Likes Received:
    2,004
    Location:
    Florida
    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. Total Noob

    Total Noob Jr. Executive VIP Jr. VIP Premium Member

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

    Didn't work unfortunately :(
     
  5. Total Noob

    Total Noob Jr. Executive VIP Jr. VIP Premium Member

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

    davids355 Moderator Staff Member Moderator Jr. VIP

    Joined:
    Apr 25, 2011
    Messages:
    13,026
    Likes Received:
    11,071
    Try:

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

     
    • Thanks Thanks x 1
  7. Total Noob

    Total Noob Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    May 10, 2009
    Messages:
    2,129
    Likes Received:
    2,004
    Location:
    Florida
    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:
    13,026
    Likes Received:
    11,071
    No problem.