header
 
     
 
pixel
pixel pixel

Protect your subdirectories

Without an index.php or index.htm in your subdirectories, a user would be able to see all the files in your directory which can be a big security flaw. The way I plug this hole is to have index.php as my directory index. Then I make sure every directory on my site that doesn't already have an index.php has the file index.php with the following code:
<?php 
header
("Location: http://www.redirecturl.com/"); 
?>
Obviously I use the domain of my site in the place of redirecturl.com. This has the effect of redirecting anyone to the website homepage if they try peeking in my subdirectories.

Unhelpful Helpful
Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image