Before finding a fix for the problem, let’s have a quick look on how the default page shows up in a website.
In cPanel, upon new Hosting account creation, server automatically copies a set of files and folders from the skeleton folder to user’s home directory. This would also include a default index.html file in the public_html or www folder of the website. By default, this page shows up when you access the new website from a browser.
Usually, users upload contents to their website folder using FTP or cPanel’s File Manager. And, when the domain has incorrect settings, wrong index page shows up.
Reasons for showing wrong index page
In many cases, even after uploading the website content to the public_html or www folder of the website, wrong page shows up. Let’s take a look at the various reasons for this.
1. Wrong .htaccess entries
By default, the following rule set in the .htaccess file of the website controls the index page.
” DirectoryIndex index.html index.php home.html home.php default.htm”
The .htaccess file is normally read from left to right and select the first available page. For example, in this case, the web server will look for the index.html file, if it is missing, it will look for the default.htm file etc.
However, when the newly designed page has a different name, say home.html, it would never show up as the default page.
2. Wrong IP address settings for domain
Often wrong IP address in the web server configuration also create problems with default index page. In such cases, domain’s DNS would take it to the correct server. But, inside Apache, it might be pointing to wrong IP. As a result, it will show the default cPanel index page.
3. Incorrect file name or path
Again, another reason for incorrect index page showing up on website happens when you forget to overwrite index.htm, index.html or index.php file during file upload. As a result, the default index page still remains on website and that shows up.
The overwrite option in cPanel’s File Manager looks as shown:
Similarly, files in servers are case sensitive. If the index file has a name Index.html, it do not match index.html or Index.php do not match index.php or index.php.php file and results in wrong page too. From our experience in managing servers, our Dedicated Engineers often see customers uploading file to the wrong directory. This again causes default index page errors on the website.
How we set proper index page for website
We just saw the various reasons for the index page problem on the website. Now, let’s see how our Technical Support Engineers fix it.
1. Modify .htaccess
In some cases, we may need to modify the .htaccess file to point to the correct index file.
If the newly designed home page of the website is main.html or main.php, we set the public_html or www directory .htaccess entry as:
” DirectoryIndex main.html main.php “
To edit the .htaccess, we either use the command line editor in SSH or cPanel’s File Manager. or you can download file via .htaccess and make changes on that, if you are unable to see file in file manager, go cpanel > file manager top right side click on setting button, popup will come up and in that popup page preferences will showing with these options:-
– Home Directory
– Web Root (public_html or www)
– Public FTP Root (public_ftp)
– Document Root for:
– Show Hidden Files (dotfiles)
– Disable Character Encoding Verification Dialogs
you need to click on Show Hidden Files (dotfiles), and press save, when you will click and save reload/ refresh your page you will see .htaccess or any file or folder that start with .(dot)
2. Verify domain IP
We begin investigation by checking whether the website resolves correctly to the server. Then, we confirm the IP address set in the Apache configuration file httpd.conf
In case of mismatch, we edit the configuration file and set it to the correct IP address.
3. Ensure index file exists
When the IP address settings are correct, we check the presence of index file in the document root of the website. For instance, in cPanel, it should be present in the public_html or www folder.
When users upload files to the sub folders, we copy the files to the correct folder. Additionally, we set the correct name for the index file, set proper permissions, etc.
That fixes the problem and correct file shows up as the default index page of the website.