Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)?*$ [NC]
RewriteRule \.(gif|jpe?g|png|wbmp)$ [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?

share|improve this question

closed as off-topic by Iain, Jenny D, mdpc, kce, MadHatter Oct 31 '13 at 15:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Iain, Jenny D, kce, MadHatter
If this question can be reworded to fit the rules in the help center, please edit the question.

Why don't you try your guess out and see what happens ? – Iain 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 (also here, and here). Server Fault 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
up vote 2 down vote accepted
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https?://%{HTTP_HOST}/.*$ [NC]
RewriteRule \.(gif|jpe?g|png|wbmp)$ %{HTTP_HOST} [R=404,L]
share|improve this answer
Thanks for your help. – Manolo Oct 30 '13 at 12:38
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 8: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

Not the answer you're looking for? Browse other questions tagged or ask your own question.