Using HTACCESS to Redirect?

Discussion in 'Programming' started by Slincon, Jun 9, 2009.

  1. #1
    Anyone know the process for using htaccess to redirect an entire domain to another domain, so if you enter:

    www.a.com/file2.html
    Code (markup):
    it will instead redirect to:
    www.b.com/file2.html
    Code (markup):
    It would need to be a 301 redirect.

    Thanks.
     
    Slincon, Jun 9, 2009 IP
  2. stOK

    stOK Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Something like this
    
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^www\.a\.com$ [NC]
    RewriteRule ^/(.*)$ http://www.b.com/$1 [L,R=301]
    
    
    Code (markup):
     
    stOK, Jun 10, 2009 IP