Is there a .htaccess to allow only image/jpeg, image/gif and image/png to be loaded/executed/viewed? I’d like to not go by the extension (as that could be forged) by the actual type/handler or whatever it should be called.
I need to completely secure a directory so php files could in no way be parsed (even if they call it something.jpg and it’s php!).
A PHP file can be executed in your server only if it has a .php extension (maybe .php3 too).
So in case you are calling a php script as:
pippo.gif
when the browser will ak for pippo.gif he will receive a normal text file instead.
It won’t executed in your local server at all,
so don’t worry…
The type/handler is related to the extension…
# If the URI is an image then we allow accesses
SetEnvIfNoCase Request_URI "\\.(gif|jpe?g|png|bmp)$" let_me_in
Order Deny,Allow
Deny from All
# Allow accesses only if an images was requested
Allow from env=let_me_in
How would I go about preventing people from hotlinking except if it’s a direct request or the referrer is from (*.)ipbfree.com (please notice the wildcard).