Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

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.

1  
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

1 Answer 1

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 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 at 14:08
    
All right, but I don't see any other question with negative score... –  Manolo Mar 14 at 14:14
    

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