Localhost showing “Index/of” instead of displaying the Website

Note: Bit older post, But if you’re searching of disabling index on website. Simply heads to the Disable Indexing of Wesbite

Probably you are trying to figure out why the heck your website is not displaying instead a dirty table is visible showing “Index/of“. This happens when the web server (local or online) is not able to either locate the index.html/index.php file or it doesn’t know which file to open by default. This kind of thing generally happens on local servers as online servers are well configured.

Sometimes there may be case when index.html is recognized by the server but index.php is unknown and the same has to be informed to the server. In both the cases checking the configuration file in the Apache folder is step one.

Steps on how to fix the Index/Of issue:

  • Locate to your web server folder in your local machine and find the folder conf within.
  • Within the conf folder there is a file “httpd.conf“. Create a copy of this file in the same folder in case of emergencies.
  • Edit the file using any text editor. I personally use Notepad++.
  • Search for “DirectoryIndex” within the file. You will find a comment and information like below.
  • Search for “DirectoryIndex” within the file. You will find a comment and information like below.
  • Make sure both the highlighted lines exist in the tag <ifModule dir_module> …… </ifModule>
  • Save the file and reset the web server.

Disable Indexing on Website

In case, you’re looking for disable the index on your website. Then you can simply at the following under your webhosting public root. ie public_html and add following snippets in your .htaccess file to instruct Apache to not to open index.

In case, you want to disable index on particular directory. Then you can simply wrap the above into Directory markup like this.

Another, more famous and easier way is create a blank index.html files under the directory.

Comment and Share if you find the post useful and it ended your search 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu