Localhost showing “Index/of” instead of displaying the Website
Note: Bit older post, But if you’re searching of disabling index of page from on website. Simply heads to the Disable Index of from 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.
1 2 3 4 5 6 7 | # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex default.html index.html index.php </IfModule> |
- 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.
1 | Options -Indexes |
In case, you want to disable index on particular directory. Then you can simply wrap the above into Directory markup like this.
1 2 3 4 5 | <Directory /var/www/> Options -Indexes +FollowSymLinks AllowOverride None Require all granted </Directory> |
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 🙂
Recent Posts
Recent Comments
- LogixTree Networks on Localhost showing “Index/of” instead of displaying the Website
- AMANUR RAHMAN on Localhost showing “Index/of” instead of displaying the Website
- Christy on Support Purchase Notes in Order Emails WooCommerce
- LogixTree Networks on Localhost showing “Index/of” instead of displaying the Website
- Sofia on Localhost showing “Index/of” instead of displaying the Website
5 Comments. Leave new
When I pressed save it turned the http.conf file into a notepad and it says it’s syncing. And now there are errors everywhere in other files. I don’t know what happened! And I didn’t make a copy of the http.conf file, I don’t know what to do! Could you help me?
Here’s an image of how the files look:
https://docs.google.com/drawings/d/e/2PACX-1vRzGwP1XNy6MGJlgzNuz2m2z5wPyup3yXlCj_g-hA0pp0FrUsKjRqdQolM6d7A1BZvnvQVRlxlOpj5d/pub?w=480&h=360
Here’s a image with better quality: https://docs.google.com/drawings/d/e/2PACX-1vRzGwP1XNy6MGJlgzNuz2m2z5wPyup3yXlCj_g-hA0pp0FrUsKjRqdQolM6d7A1BZvnvQVRlxlOpj5d/pub?w=1440&h=1080
Hi Sofia, That’s normal. For double-check, just enable your extensions and check if it’s not .txt file.
https://logixtree.in/wp-content/uploads/2020/09/Screenshot_166.png
>>Localhost showing “Index/of” instead of displaying the Website<<
I carried out the given process. It seems DirectoryIndex is o.k. It looks like this-
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
What next should I try ?
Hello Rehman,
Please let me know if you’re still seeing the Directory List. Then there might be an issue with vhost settings. Ping me on Skype. I will connect remotely to look.