Don't allow direct link access to images

  • jordonshaw
  • Student
  • Student
  • User avatar
  • Posts: 99
  • Loc: Tennessee

Post 70 days ago

Okay, I have a PHP application, running on Windows server in IIS. I want to stop direct link access to the images unless they are being accessed through my PHP application. I tried moving it to a folder outside of IIS, such as C:\Images; however, the browser is blocking access to that. I've played with setting up a web.config file to prevent access, which worked; however, it prevented the access to the images from my application as well. I cannot for the life of me, figure out how to allow access from my application, but block all other access.

Thank you in advance!
Jordon
  • spork
  • Brewmaster
  • Silver Member
  • spork
  • Posts: 6297
  • Loc: Seattle, WA

Post 69 days ago

Does this work?
http://stackoverflow.com/questions/2110 ... -and-https

I haven't use IIS in a while but Googling "iis disable image hotlinking" gave plenty of results.
  • jordonshaw
  • Student
  • Student
  • User avatar
  • Posts: 99
  • Loc: Tennessee

Post 69 days ago

Thank you for this information. I actually have that exact configuration in place; however, it's not working. My web.config file looks exactly like that page. I actually think that page is where I started this process.
  • jordonshaw
  • Student
  • Student
  • User avatar
  • Posts: 99
  • Loc: Tennessee

Post 69 days ago

Okay, I finally figured it out. He had negate="true" on both of his conditions. It wasn't needed on the pattern="^$" condition. Once I removed that, it worked like a charm.
  • spork
  • Brewmaster
  • Silver Member
  • spork
  • Posts: 6297
  • Loc: Seattle, WA

Post 69 days ago

Cool, glad you got it working!

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 33 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.