-3

I have this snippet code in my .htaccess file to prevent users from hotlinking the server's images:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^$ [OR] 
RewriteCond %{HTTP_REFERER} !^http://(www.)?itransformer.es/.*$ [NC]
RewriteRule \.(gif|jpe?g|png|wbmp)$ http://itransformer.es [R,L]

Of course, it is not working in my localhost, but don't know how to achieve it. My guess is that I should change the domain name with any wildcard. Any idea?

Manolo
  • 512
  • 2
  • 8
  • 22
  • 1
    Why don't you try your guess out and see what happens ? – user9517 Oct 29 '13 at 16:38
  • I'd do it, but how? – Manolo Oct 29 '13 at 16:39
  • @ManoloSalsas Begin by [reading the manual](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) (also [here](http://httpd.apache.org/docs/2.0/misc/rewriteguide.html), and [here](http://serverfault.com/questions/214512/everything-you-ever-wanted-to-know-about-mod-rewrite-rules-but-were-afraid-to-as)). [SF] is a place for getting help doing your work, not for us to do the work for you. – voretaq7 Oct 29 '13 at 16:44
  • @Iain - Sorry for that. I think now it could help someone. – Manolo Oct 30 '13 at 12:40
  • @voretaq7 - Thanks for the reference. Now I'm ready to begin understanding the syntax. I was really confused. – Manolo Oct 30 '13 at 12:45

1 Answers1

2
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https?://%{HTTP_HOST}/.*$ [NC]
RewriteRule \.(gif|jpe?g|png|wbmp)$ %{HTTP_HOST} [R=404,L]
Chris S
  • 77,337
  • 11
  • 120
  • 212
  • This question seems to be blocking my account. I've edited my question a few times but nothing changes. Could you please vote me up so I can ask more questions? Thanks in advance. – Manolo Mar 14 '14 at 08:03
  • It's not just this question, but also your other two with negative scores. You could contribute some positive Answers to other people's questions, once you get an upvote or two the ban will be automatically lifted. – Chris S Mar 14 '14 at 14:08
  • All right, but I don't see any other question with negative score... – Manolo Mar 14 '14 at 14:14
  • http://serverfault.com/questions/545821/unknown-processes-of-apache2 and http://serverfault.com/questions/532267/my-server-has-falled-over – Chris S Mar 14 '14 at 15:01
  • Oh! Thanks. I thought they were definitively removed. – Manolo Mar 14 '14 at 15:08