Hotlink code prevent images from display in email

hi all

i have this in my htaccess file

RewriteCond %{HTTP_REFERER} !^http://(.+\\.)?domainname\\ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\\.(jpe?g|gif|bmp|png|swf)$ /images/nohotlink.jpe [L]

The problem :
my customers are not able to see the product images in html emailer sent from my server to their email.

If i remove this code from my htaccess then the images are displayed fine in their email.

Is my code incorrect ???


Is your code incorrect. Yes. Email is being displayed via a different web server, different HTTP_REFERER. So just remove the hotlink protection all together.

hi logic_earth

is there any solution which can solve both purposes

means i can prevent hotlinking and my customers can see images in their emails also



If you’re using hotlinked images in your e-mail, copy them to a folder dedicated to your e-mail and add an exclusion for this folder to your .htaccess in the DocumentRoot.



Most people will not see linked images in emails anyway - if you really want people to see them you should embed the image directly in the email so that the email doesn’t have to access the web to retrieve the image.

hi DK

instead of creating a new folder and copying images in it,

Is it possible to add an exclusion for 5-6 images that are in the images folder ??


hi felgall

In the html newsletter, I am using full path for images


Yes - images linked like that will be blocked so that recipients will not see them without their taking additional steps to specifically allow the image to display.

You need the full path to link to images from emails. You also then need your visitor to click the link in their email program while viewing your email to allow those links to be followed to display the images.

To avoid confirming your email address to spammers by allowing it to be logged when your email program downloads their linked 1x1 pixel transparent image people should only ever allow linked images to be displayed when they are 200% certain of where the email came from.

Embedded images are contained in the email itself and so do not rely on access to a web site in order for them to display.

I have an article discussing the pros and cons of linking or embedding images at


Yes, you can also exclude images using RewriteCond statement(s). Show the code you want to use and I can help with that.