Handling Index.html Error Issues in WordPress

This quick tutorial will help you fix 404 error issue when you request index.html for your WordPress site. If you initially started out with WordPress you will not have this problem, but those who were on different platforms or had static websites that used index.html page, then converted to WordPress might still have old links pointing to domain.com/index.html.

It is a good practice to make your website’s homepage available ONLY under “domain.com” or ONLY under “www.domain.com”. If your website is available under

  • domain.com/index.html
  • domain.com
  • www.domain.com
  • www.domain.com/index.html

you are deluding link juice and wasting PageRank. While it’s true that Google can sometimes figure out that all these are same, it is not always the case. It is your responsibility to set up your website properly and quit relying on Google to figure things out.

Back to index.html issue, some WordPress themes and frameworks will handle that automatically. You can test that by typing in yoursite.com/index.html into your browser and see what you get.

If you get homepage you don’t need to do anything, if you get 404 page we need to fix that.

Method 1

If you have a static page set as your homepage and are using plugin like .html on pages to add .html at the end of your pages’ URLs, you can easily fix the issue by doing the following:

  • Temporarily assign any other page to be your homepage (just for about 20 seconds, promise!) via Reading–>Settings.
  • Now go to Pages and find your original homepage and edit it’s URL to be index.html.
  • Go back to Settings –> Reading and assign this page to be your homepage again.
  • Check domain.com/index.html to make sure things work as expected.

Method 2

Install a plugin like “All 404 Redirect to Homepage” and it will always redirect all 404s (Page Not Found) including typos, broken links and non-existent index.html to your homepage.

Method 3

Another way is to first create index.html, then redirect it to homepage. This will not work on hosts that default to index.html BEFORE index.php. Hostgator and Stablehost default to index.html and if you attempt to do this there you will only get blank page instead of homepage. If you are using Hostgator, Stablehost or other host that has similar setup you should either use first method or contact your host and ask them to change default index page for you. Once they do you should be able to do what’s below.

Site5, on the other hand, doesn’t default to index.html from what I can see and this method worked there immediately.

First to create index.html:

1. Go to cPanel and choose File Manager (NOT Legacy File Manager), click on that and choose web root/public_html.

2. Once you are in your file manager click New File icon in the top left (NOT New Folder).

3. Create index.html by simply typing index.html and clicking Create New File.

create new file cpanel

4. Return to your cPanel and find URL Redirects and click to enter.

5. Add a new redirect by filling as follows:

– Type 301 (Permanent)
– Choose your site URL from drop-down menu and complete it by typing index.html in the blank area after the slash /
– Set it to with and without www

Here is how it should look like (please paste in the field “Redirects To” the version of homepage URL you are using, it can be either http://www.domain.com or http://domain.com. If you are an ex-SBIer you should use http://www.domain.com):

redirect cpanel

6. Click Add and you should be done.

Type into your browser yourdomain.com/index.html once again and see if redirect worked (it should!).