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

redirect the whole domain and iinner pages in the same domain

Discussion in 'Black Hat SEO' started by virtualbyron, Feb 15, 2015.

  1. virtualbyron

    virtualbyron Jr. VIP Jr. VIP

    Joined:
    May 11, 2014
    Messages:
    1,243
    Likes Received:
    794
    Occupation:
    WHITE HAT
    Home Page:
    Hello mate,

    I wish redirect the whole domain and specific inner pages in the same domain

    For exemple :

    301 redirect whole domain:
    domain1.com to domain2.com

    and

    301 redirect for inner page like :
    domain1.com/0001 to domain2.com/0001
    domain1.com/0002 to domain2.com/0002
    domain1.com/0003 to domain2.com/0003

    How can I do that if are possible?

    it is because I have the same page with the same keyword already classified with some nice links

    Thanks a lot !

    EDIT : I'll upload all the post in domain1.com to domain2.com it will not be any duplicate content issues?
     
    Last edited: Feb 15, 2015
  2. dsan996

    dsan996 Regular Member

    Joined:
    Apr 18, 2014
    Messages:
    267
    Likes Received:
    128
    Location:
    Depends on the day
    You have to use a regex to rewrite the domain name and keep the same path. Something like this:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain1.com [NC]
    RewriteRule ^(.*)$ http://domain2.com/$1 [L,R=301]
    
    Before making any changes:

    1. Backup your htaccess file.
    2. Read some resources about "redirecting an Old Domain to a New Domain with .htaccess" (there are many reasons why the above code could fail and you may need to tweak it):

    http://enarion.net/web/htaccess/migrate-domains/
    http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url
    http://301redirects.net/redirect-old-domain-to-new-website.php
    http://stackoverflow.com/questions/...ain-to-new-domain-while-structure-of-pages-an
    http://wpscholar.com/blog/redirect-an-old-domain-to-a-new-domain-with-htaccess/
     
    • Thanks Thanks x 1
  3. virtualbyron

    virtualbyron Jr. VIP Jr. VIP

    Joined:
    May 11, 2014
    Messages:
    1,243
    Likes Received:
    794
    Occupation:
    WHITE HAT
    Home Page:
    Thanks dsan996 for your great help !