SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    hotlink code prevent images from display in email

    hi all

    i have this in my htaccess file

    Code:
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domainname\.co.in/ [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 ???

    vineet

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    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.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    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

    vineet

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Yes,

    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.

    Regards

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    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.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Yes,

    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.

    Regards

    DK
    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 ??

    vineet

  7. #7
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    619
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    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 felgall

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

    http://www.domain.co.in/images/image.jpg

    vineet

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,600
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by vinpkl View Post
    hi felgall

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

    http://www.domain.co.in/images/image.jpg

    vineet
    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 http://www.felgall.com/brsgen15.htm
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    vineet,

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

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •