Please help with htaccess file...

Discussion in 'Site & Server Administration' started by itsall3, Apr 30, 2007.

  1. #1
    Hi guys,

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?google.com/ig(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?live.com(/)?.*$     [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp|swf)$ http://www.site1.com [R,NC]
    Code (markup):
    Can somone please help sort this htaccess file.

    I would like the domain to accept any site extension. So, instead of google.com/ig -- i would want it to include google.com/.co.uk/.eu/.ch/etc

    There are so many google extensions, and live.com, i dont know what they use. I cannot simply include them all.

    Is there anyway to let it pick them all up themselves.

    Cheers.

    Thanks.
     
    itsall3, Apr 30, 2007 IP
  2. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #2
    I haven't tested this yet so if it doesn't, post again.
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://yourdomain.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://google [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.google [NC]
    RewriteCond %{HTTP_REFERER} !^http://live.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.live.com [NC]
    RewriteRule [^/]+.(gif|jpg|jpeg|bmp|swf)$ http://www.site1.com [R=301,NC]
    Code (markup):
     
    VimF, May 3, 2007 IP