Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Location
    USA
    Posts
    364
    Thanks
    12
    Thanked 6 Times in 6 Posts

    htacess replace image

    Hi,
    I already have an htacces file. I was looking for how to make the hotlinked image be replaced with a "stolen" image. Where do I add it?

    Original:
    Code:
    Options All -Indexes
    
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://othersite.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf|cur|ani|mid|mp3|mov|wma)$ - [F,NC]
    Where do I put this:
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule \.(jpe?g|gif|bmp|png)$ /images/stolen.gif [L]

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    USA
    Posts
    364
    Thanks
    12
    Thanked 6 Times in 6 Posts
    Anybody?

    I just need to know how to combine the two htaccesses.

  • #3
    Regular Coder
    Join Date
    Jan 2004
    Location
    USA
    Posts
    364
    Thanks
    12
    Thanked 6 Times in 6 Posts
    Somebody? Please. I need help with the htaccess. It should be really simple.

  • #4
    Regular Coder
    Join Date
    May 2004
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,
    do you actually have files with all those extensions on your site? jpeg, bmp? And what about Google? Anyways, you could try the following:
    Code:
    Options All -Indexes
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://.*google.([^/]+)$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?othersite\.com [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
    RewriteRule .*\.(swf|cur|ani|mid|mp3|mov|wma)$ - [F]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
    RewriteCond %{REQUEST_URI} !^/images/stolen.gif [NC]
    RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/stolen.gif [R,L]

  • #5
    Regular Coder
    Join Date
    Jan 2004
    Location
    USA
    Posts
    364
    Thanks
    12
    Thanked 6 Times in 6 Posts
    do you actually have files with all those extensions on your site? jpeg, bmp?
    Most of them.

    And what about Google?
    What do you mean? The google part is for allowing Google to hotlink.

    So the code you posted will:
    1) Allow "mysite.com", "othersite.com" and Google to hotlink these extensions: "swf, cur, ani, mid, mp3, mov, wma"
    2) Replace any hotlinked image with "stolen.gif" for referers other than "mysite.com"

    I'll try it. Thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •