.htaccess Help!

Discussion in 'Apache' started by donnie, Sep 24, 2009.

  1. #1
    I want to redirect traffic coming from certain URL’s and my .htaccess looks like this:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} domain1\.com/ [NC]
    RewriteRule ^$ http://domain2.com [L]

    It works and traffic coming from domain1 is redirected to domain2. But how do I add more domains I want to redirect from?
    I have tried adding one more line like this but that is not working:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} domain1\.com/ [NC]
    RewriteCond %{HTTP_REFERER} domain3\.com/ [NC]
    RewriteRule ^$ http://domain2.com [L]
     
    donnie, Sep 24, 2009 IP
  2. bogi

    bogi Well-Known Member

    Messages:
    482
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    140
    #2
    Try this:

    Options +FollowSymLinks
    RewriteEngine on
    
    RewriteCond %{HTTP_REFERER} domain1\.com/ [NC]
    RewriteRule ^$ http://domain2.com [L] 
    
    RewriteCond %{HTTP_REFERER} domain3\.com/ [NC]
    RewriteRule ^$ http://domain2.com [L] 
    Code (markup):
     
    bogi, Sep 24, 2009 IP