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.

Redirecting Entire website to ANother domain

Discussion in 'Apache' started by sarathy, Jul 13, 2006.

  1. #1
    How do i redirect an entire website to another domain?.,

    For example:
    domain.com > Anotherdomain.com/index.php
    domain.com/<anything/<anything.html> > Anotherdomain.com/index.php
    domain.com/<anything>/anything/........ > Anotherdomain.com/index.php

    thru .htacess

    Pls help :)

    Sarathy.s
     
    sarathy, Jul 13, 2006 IP
  2. sreyas

    sreyas Well-Known Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Here you go
    
    RewriteEngine on
    RewriteRule   ^/(.+)  http://newdomain.com/$1  [R,L]
    
    Code (markup):
     
    sreyas, Jul 13, 2006 IP
  3. sarathy

    sarathy Peon

    Messages:
    1,613
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks sreyas i wil try that out :)

    Sarathy.s
     
    sarathy, Jul 13, 2006 IP
  4. radmoose

    radmoose Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    sreyas

    Not to completely hijack the thread.... :)

    I have a bunch of domains (common misspellings of my main domain) that I want everything to be redirected to the main domain.
    Your code would do that, except that I don't want it to redirect if the visitor is at newdomain.com... is there a correct way to check to see if they are on "newdomain.com" don't transfer, otherwise if they are on something else (ie "newdomian.com") transfer?

     
    RewriteEngine on
    RewriteRule   ^/(.+)  http://newdomain.com/$1  [R,L]
    
    Code (markup):
     
    radmoose, Jul 14, 2006 IP
  5. sreyas

    sreyas Well-Known Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Hi,

    I din't clearly get your query, but upto what I understand.

    If you want to redirect, newdmain.com, newdomian.com etc to your main domain just put this code that particular domains .htaccess file. And you dont need to put the same in correct newdomain.com, it just work without any change. Am I upto your query?

    Do update
     
    sreyas, Jul 14, 2006 IP
  6. error10

    error10 Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^newdomain\.com$
    RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
    Code (markup):
    Or R=302 :)
     
    error10, Jul 16, 2006 IP
  7. nddb

    nddb Peon

    Messages:
    803
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #7
    nddb, Jul 17, 2006 IP