Recently, I had to develop an interactive website in PHP. All went well, testing on the localhost worked like a charm, however, when I uploaded the website to the online server, I kept getting this message “Directory Listing Denied”.
When I visited the website at http://yoursite.com, I kept on getting the error message. However, typing the full address to the page http://yoursite.com/index.php worked just fine.
So, after a long search, I found out that the hosting provider didn’t actually support index.php as a default URL redirection (which is really strange considering the popularity of PHP). Anyway, I had no access to the domain settings or the hosting login, I could only access the website using FTP.
So, my solution was to resort to the very old trick of redirection. To solve this directory listing denied issue, I have created an HTML page, index.html, and used the simple HTML redirection method.
To do this, I have added this line of code in the head section of my index.html page:
<meta http-equiv="REFRESH" content="0;url=http://yoursite.com/index.php">
So, basically, after “0” seconds on index.html, the user will be redirected to index.php which had my application home page.
Now, this solution might not be SEO friendly, so, you might want to add some title and description meta tags to this page.
This solution worked fine for me while I was waiting for the hosting provider to add index.php to the default URL redirection list.
So, hope this might be useful for anybody who is having troubles with the “Directory Listing Denied” Message or even the “Forbidden” message sometimes. If you found this article useful, pass it on and share it with your friends!