JRS Posted September 25, 2006 Share Posted September 25, 2006 Hello,Is there a way to stop all the files from being listed if an invalid file name is entered?For example I havewww.mysite.com/scripts/main.phpIf I type in : www/mysite.com/scripts/Then all the files in that directory are displayed to end user.Is there a way I can prevent all the files from being displayed to the user?Thanks in advanceJRS Link to comment https://forums.phpfreaks.com/topic/22001-how-to-stop-files-from-being-listed/ Share on other sites More sharing options...
alpine Posted September 25, 2006 Share Posted September 25, 2006 easiest way: put an empty index.html in the directory Link to comment https://forums.phpfreaks.com/topic/22001-how-to-stop-files-from-being-listed/#findComment-98308 Share on other sites More sharing options...
wildteen88 Posted September 25, 2006 Share Posted September 25, 2006 Or add a .htaccess file in to the scripts folder and add the followingto the htaccess file:[code]Options -Indexes[/code]When you go to the scripts folder the user will get the [b]403 Forbidden[/b] error message Link to comment https://forums.phpfreaks.com/topic/22001-how-to-stop-files-from-being-listed/#findComment-98325 Share on other sites More sharing options...
JRS Posted September 26, 2006 Author Share Posted September 26, 2006 alpine, wildteen88Thank you very much for your suggestions. It was a great help.This one is solved!JRS Link to comment https://forums.phpfreaks.com/topic/22001-how-to-stop-files-from-being-listed/#findComment-98667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.