Portal Home > Knowledgebase > Articles Database > Visitors can directly access subfolders + admin php Files - how to prevent?


Visitors can directly access subfolders + admin php Files - how to prevent?




Posted by chocomarker1, 01-11-2011, 12:43 PM
for example I have this website that was done by a programmer who doesn't work for me anymore. www.example.com/admin/configure if you know what to type in after admin, or just make a few guesses, you can easy access the whole directory. or www.example.com/images it will let you browse through all the images. Obviously, the issue with the admin is a bigger concern of mine, coz people could just download the php files and look at how everything works... How can I prevent the user from browsing through my server? it's a dedicated one.

Posted by asciiDigital, 01-11-2011, 01:22 PM
add this line to your .htaccess file: deny from all

Posted by Aquickhost, 01-11-2011, 01:24 PM
make a blank index.html file inside your folder. It will prevent directory listing. Or use .htaccess method as mentioned above by asciiDigital.

Posted by jNive, 01-11-2011, 03:31 PM
also to clarify - you cannot download php files unless the server isn't configured with PHP to start with (in which case .php is treated as plain text and will display the source code).

Posted by krizag, 01-11-2011, 03:54 PM
disable directory listing for the directories.

Posted by chocomarker1, 01-12-2011, 05:44 AM
asciiDigital, Aquickhost, jNive, krizag, Thanks for your great help!!! Actually I started out putting a xhtaccess file in every directory pointing to index.html and then inserting an index.html file into every directory along with it. Then I came across the cPanel function that the directory browsing can actually be deactivated, so I did that Thank you!!!

Posted by jNive, 01-12-2011, 05:26 PM
indeed - and it can also be done on a folder by folder basis via a .htaccess file via the following command Options -Indexes

Posted by asciiDigital, 01-12-2011, 06:04 PM
You only need the .htaccess file in the root public_html folder and it will apply to all subfolders.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Docker (Views: 757)


Language: