How to redirect all invalid url to another page?

Discussion in 'Site & Server Administration' started by duskdawn, Jul 12, 2006.

  1. #1
    Hi,
    I changed site url recently but I don't want to lose the SE traffic. So I wonder how can I redirect all the old indexed url to the new site.
    For example:
    www.xyz.com/d28-0?.pjh8784 -------> www.abc.com
    Thank you for your help.
     
    duskdawn, Jul 12, 2006 IP
  2. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #2
    User redirection via .htaccess with mod_rewrite this way

    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^xyz.com/d28-0?.pjh8784$ [OR]
    RewriteCond %{HTTP_HOST} ^www.xyz.com/d28-0?.pjh8784$
    RewriteRule ^(.*)$ http://www.abc.com [R=301,L]
    
    Code (markup):
    or simple redirect:

    
    Redirect 301 /d28-0?.pjh8784  http://www.abc.com
    
    Code (markup):
     
    Mystique, Jul 12, 2006 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ http://www.domain.com/$1/ [R=301,L]
     
    Nintendo, Jul 12, 2006 IP
  4. sreyas

    sreyas Well-Known Member

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