Good solution for protecting image files in folder |
[eluser]esset[/eluser]
So let's say I have a folder in my server-root called /images/. Now I want to protect all images in this folder (and subfolder) from direct access (like www.mydomain.com/images/001/image.jpg). But I still want my server and/or PHP files to be able to access this folder (and subfolders/images). Anyone got a good solution for this? Thanks ![]()
[eluser]laytone[/eluser]
create a file in /images called .htaccess add the line: Code: Options -Indexes
[eluser]esset[/eluser]
Will disabling "not allowing peaking into folder with no index" not prevent my regular site from accessing the files to? Sbioko: What should that .htaccess file contain? Thanks
[eluser]esset[/eluser]
[quote author="laytone" date="1266285181"]create a file in /images called .htaccess add the line: Code: Options -Indexes I tried this but it didn't work, I can still access images in /images/ straight away. Can my .htaccess in site-root conflict? This is my .htaccess in root: Quote:RewriteEngine On Thanks
[eluser]laytone[/eluser]
Try adding that line to your root .htaccess and see if it works...
[eluser]esset[/eluser]
Sorry no change. Should I use something like "deny from all"?
[eluser]laytone[/eluser]
I feel stupid for not thinking of this earlier. you could just Create a blank index.html file and put it in your images folder...
[eluser]esset[/eluser]
[quote author="laytone" date="1266288014"]I feel stupid for not thinking of this earlier. you could just Create a blank index.html file and put it in your images folder...[/quote] That wont protect me from people direct-linking the images though, right? http://www.thesitewizard.com/archive/ban...heft.shtml didn't work, the images still render in /images/. I wonder if it somehow conflicts with the mod_rewrite rule? I guess I could do http://www.thesitewizard.com/archive/pro...ages.shtml, but I would like not to edit all the places I have linked to these images on the site ![]() Thanks for helping out |
Welcome Guest, Not a member yet? Register Sign In |