Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am using following htaccess code to stop hot linking my image files

Options +FollowSymlinks
Options +SymlinksIfOwnerMatch

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?article-stack.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
ReWriteRule .*.(png|gif|jpg)$ - [N,F,L]

Still the imge of my site are accessible from other sites. how can i stop it?

share|improve this question

2 Answers 2

I think you're missing an escape for the . in your domain name:

Options +FollowSymlinks
Options +SymlinksIfOwnerMatch

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?article-stack\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
ReWriteRule .*.(png|gif|jpg)$ - [N,F,L]
share|improve this answer
1  
If that were the only problem wouldn't that cause the image not to be accessible from his domain, rather than causing it to be accessible from everywhere? –  BenV Oct 28 '10 at 22:12
    
good observation. But '.' refers to any single char. would it not include '.' char itself? i also support @BenV question –  articlestack Oct 29 '10 at 7:37

I tried your code on my local setup and it worked fine. It's likely that something else in your .htaccess is causing this to fail.

I notice that you are rewriting the images to http://article-stack.com/- which redirects to another page. It would be best to rewrite to another image or to a 404 error.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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