Old domain to new domain

Discussion in 'Apache' started by joe_mat, Aug 27, 2007.

  1. #1
    I have just moved a domain and would like to know how to redirect everything from the old domain to the new domain.

    With the following code it redirects all pages to the new domain

    Code:

    RewriteCond %{HTTP_HOST} ^.*oldwebsite\.com$ [NC]
    RewriteRule ^(.*)$ http://www.newwebsite.net/$1 [R=301,L]

    so oldwebsite.com -> newwebsite.net

    The problem is that oldwebsite.com/folder/file1.html is also -> newwebsite.net

    What is the code for having oldwebsite.com/folder/file1.html automaticly redirecting to newwebsite.net/
     
    joe_mat, Aug 27, 2007 IP
  2. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #2
    I'm not sure what you're asking for but I think mod_alias might work better in this case:

    
    Redirect 301 / http://www.newwebsite.net/
    
    Code (markup):
     
    VimF, Aug 27, 2007 IP
  3. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
     
    powerspike, Aug 27, 2007 IP