1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess Redirect ALL traffic to another site

Discussion in 'Apache' started by klubz, Jun 1, 2008.

  1. #1
    Hi...I am looking to redirect ALL the traffic from one site to another on the same server. the traffic is from thousands of links in the search engine and many are dead links going to a 404 error...I am looking to redirect all the traffic and wondered if this would be done through .htaccess or another way...Any help or alternative solutions would be appreciated...Thanks
     
    klubz, Jun 1, 2008 IP
  2. Trusted Writer

    Trusted Writer Banned

    Messages:
    1,370
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Add a normal .htaccess permanent redirection rule in your old domain pointing to your new domian and the following rewrite rule in your new one

    OLD DOMAIN:
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 
    
    Code (markup):
    NEW DOMAIN
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.[a-z-]+\.[a-z]{2,6} [NC]
    RewriteCond %{HTTP_HOST} ([a-z-]+\.[a-z]{2,6})$     [NC]
    RewriteRule ^/(.*)$ http://%1/$1 [R=301,L] 
    Code (markup):
     
    Trusted Writer, Jun 1, 2008 IP
  3. b4bilal

    b4bilal Peon

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    for redirects another way is using php if you want to redirect any page or any site to another just just add this in a file <? header('Location: http://www.sitename.com'); ?> and save this with name index.php thats it :)
     
    b4bilal, Jun 7, 2008 IP
  4. hugl3

    hugl3 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    IMHO, if using PHP you should do:

    <?
    header("HTTP/1.1 301");
    header("location: http://your_new_page.com");
    ?>

    Firstly you say, that the age was moved permanently, and then redirect user to your page

    cheers
     
    hugl3, Jun 7, 2008 IP