Wordpress - What's the purpose of index.php in wp-content directory?
Try to visit through the folder structure of your site from the browser:
http://example.com/wp-content/
You will see a blank page. That's actually is the index.php
, and its content is very simple - a commented out PHP comment:
<?php
// Silence is golden.
Remove the file and visit the URL again. You will see the file structure completely. So your file structure is completely become naked.
That's why the file is there. To hide the inner file structure whatever that be.
O, don't forget to create the file again there. :)
This file is just there if the server (Apache, Nginx, Lighttp, etc.) is not properly set up and allowing this kind of file system access for guests. To properly set up your Apache for e.g., just add the following to your .htaccess
Options –Indexes
which will lead to a Forbidden|403
for everyone trying to access your directory structure (prevents directory listings). There is a more detailed explanation as well.
The
Options
directive is the place where you can enable or disable the index generation. This is set by default toALL
(meaning that it will turn ON also Indexes), but normally you will see this overwritten by each distribution either globally or inside the default vhost definition.