I have the follow .htaccess
inside upload
directory:
order allow,deny
deny from all
I want to allow <img src="upload/image.png" />
but get forbbiden error (403).
How I can deny direct access but allow html "inclusion" (regular html)?
I have the follow .htaccess
inside upload
directory:
order allow,deny
deny from all
I want to allow <img src="upload/image.png" />
but get forbbiden error (403).
How I can deny direct access but allow html "inclusion" (regular html)?
What are you trying to accomplish? You could base64 encode the images and place them inside the img tag's src attribute itself, using a technique similar to what is done here: http://www.greywyvern.com/code/php/binary2base64
There are possibly more advanced ways to obscure the image data, but ultimately you can't keep it from somebody who wants to hack around.
You'll need mod_rewrite on,
Be sure to replace "mydomain.com" with your own.
You can't (reliably).
Whether viewed directly or as an
<img>
tag, the browser still makes a request tohttp://yoursite.example.com/upload/image.png
, the two requests will basically be identical as far as the server is concerned.Now in most browsers, the request from the
<img>
tag will be accompanied with aReferer:
HTTP header which you can use in your Apache config to filter those requests, however:curl -e 'http://my_referer.example.com' 'http://yoursite.example.com/upload/image.png'