: 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?
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?
More posts by @Megan663
2 Comments
Sorted by latest first Latest Oldest Best
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.)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.