Mobile app version of vmapp.org
Login or Join
Megan663

: How to show your homepage on www.example.com rather than /Index.html How do you configure a site so that when someone is on your home page, they are looking at www.example.com, rather than www.example.com/Index.html?

@Megan663

Posted in: #Homepage #Url #WebHosting

How do you configure a site so that when someone is on your home page, they are looking at example.com, rather than example.com/Index.html? I would like it to show the way that Google's homepage does.

Is it possible with a simple HTML site running on shared hosting with FTP access?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

In addition to Evgeniy's answer which handles the situation when the /index.html URL is inadvertently exposed (and indexed) and needs to be canonicalised, you should also ensure that you always link to the bare URL, ie. / and not /index.html. The end user should never see "index.html" anywhere.

For / (the bare directory) to work (to silently request index.html) you need to ensure that mod_dir is enabled (it is be default) and that the DirectoryIndex is set appropriately (default is index.html). For example:

DirectoryIndex index.html index.php


The DirectoryIndex directive tells Apache which file to serve when a filesystem directory (eg. example.com/ or example.com/directory/, etc.) has been requested. In this case it will look for index.html and if not found will check for index.php, etc. in the respective directory.

To also help the search engines to always index (or at least, return in the SERPs) the correct/canonical URL you can include a rel="canonical" element in the head section of your pages pointing to the correct URL. For example:

<link rel="canonical" href="http://example.com/">


And lastly, setup an external redirect to correct any index.html URLs that have already been indexed. (See Evgeniy's answer.)

10% popularity Vote Up Vote Down


 

@Bryan171

if running Apache use following rule in htaccess:

RewriteCond %{THE_REQUEST} ^.*/Index.html
RewriteRule ^(.*)Index.html$ / [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme