Redirect 301 Hosting Linux

Discussion in 'Black Hat SEO' started by emilix123, Dec 28, 2011.

  1. emilix123

    emilix123 Junior Member

    Joined:
    Apr 14, 2010
    Messages:
    161
    Likes Received:
    2
    Hi guys I would like to know the code to perform a 301 redirect on my site to another site? I have a Hosting Linux

    Thanks
     
  2. paincake

    paincake Power Member

    Joined:
    Aug 18, 2010
    Messages:
    716
    Likes Received:
    3,101
    Home Page:
    put this in index.php
    PHP:
    <?php
    header
    ('Location: http://www.example.com/');
    ?>
    Or put this in .htaccess file (this will redirect all urls):
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldsite\.com\.?(:[0-9]*)?$ [NC]
    RewriteRule ^(.*)$ http://newsite.com/$1 [R=301,L]
    
    Next time use google to find a solution
     
    Last edited: Dec 28, 2011
  3. emilix123

    emilix123 Junior Member

    Joined:
    Apr 14, 2010
    Messages:
    161
    Likes Received:
    2
    Thanks for the reply sorry but I must make a redirect from a subdomain (name.domain.com) to a external domain (site.com) the code in .htaccess file is the same?

    because don't work....
     
  4. emilix123

    emilix123 Junior Member

    Joined:
    Apr 14, 2010
    Messages:
    161
    Likes Received:
    2
    any ideas?