Milosz Posted October 30, 2008 Share Posted October 30, 2008 Hello, I'd like to disable the DirectoryIndex completely for a certain directory; the reason being that users are able to upload files to this directory and I don't want some prankster uploading his/her own index.html . There must be a better way to do this than: DirectoryIndex highly_improbable_file_name.obscure_extension I looked at http://www.auburn.edu/docs/apache/mod/mod_dir.html but was unable to find an answer. Perhaps someone here might know? Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 30, 2008 Share Posted October 30, 2008 Put your own index.html file in the folder and preventing any uploaded file from overwriting it, either by setting permissions or making sure the upload script never overwrites it. Your upload script should be validating the file name of uploaded files or it should be building file names completely under your control (having nothing to do with any part of the uploaded file name) and then relating your built file name back to the original file name using a database table. Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/#findComment-678800 Share on other sites More sharing options...
neogranas Posted November 3, 2008 Share Posted November 3, 2008 Err, redacted for lack of reading what you originally posted. You could possibly change ownership to nobody and make it an unwritable folder, but if you need people to upload to it, you'll either have to have it set up so that they login or you may just have to hope that they don't botch it. Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/#findComment-681366 Share on other sites More sharing options...
rhodesa Posted November 3, 2008 Share Posted November 3, 2008 in an .htaccess file in that dir, put: Options -Indexes Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/#findComment-681377 Share on other sites More sharing options...
mummana Posted November 6, 2008 Share Posted November 6, 2008 pls. use the below settings: # to prevent the directory listing IndexIgnore * Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/#findComment-683972 Share on other sites More sharing options...
corbin Posted November 6, 2008 Share Posted November 6, 2008 pls. use the below settings: # to prevent the directory listing IndexIgnore * You do realize that disabling Indexes is much, much faster, yes? Quote Link to comment https://forums.phpfreaks.com/topic/130792-disabling-directoryindex-not-directory-listing/#findComment-684081 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.