I want to set www.domain.com to www.domain.com/index.html. How can I do that?

August 27, 2016 2.2k views

So my site is hosted on Digital Ocean and the problem I am running into is for some reason or another it won't​ load the most recent version of itself into the main home page. But if I type www.domainName.com/index.html, that is the current page. How can I set www.domainName.com equal to www.domainName.com/index.html.

Any help would be greatly appreciated!!

2 Answers

Unless you have another index file like index.htm or index.php that is taking precedence this is likely just a matter of needing to clear your browser cache. If you connect through a corporate or school network or are on certain ISPs it is also possible that the old version of your page is being cached elsewhere. In general I would recommend clearing the browser cache or trying a different browser first to rule that out.

You will want to edit this file:

sudo nano /etc/apache2/mods-enabled/dir.conf

For example. My website is in PHP, so my dir.conf file looks like this:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

Since you want index.html to be served first, edit your file like this:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!