How to remove /index.html

How to remove /index.html - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the How to remove /index.html error on your web browser. Problem :


How to make redirect /index.html -> / in Apache?



Redirect /index.html http://domain-name.com/


Is causeing infinite loop when opening home page.


Solution :

It is most likely causing an infinite loop as they are the same. The default pages in Apache are index.html and index.htm.



If the browser does not request a file name the web server will return one of those files if it finds them.
So When you go to http://domain-name.com you are actually viewing http://domain-name.com/index.html just without /index.html



Just do it the other way round, instead of redirecting to the domain example.com, tell the server which page to display when a user requests the domain directly.



In the .htaccess file you can write (this is the default anyway):



DirectoryIndex index.html


Now if somebody requests http://example.com the server will actually send back the index.html file, but the browser still displays http://example.com. If somebody requests http://example.com/index.html there is no reason not to deliver this page, as long as you do not link to this URL somewhere, nobody will ever request it in this form.



From an SEO perspective, if example.com/ and example.com/index.html are the same, use canonical links to address it.


We hope that this article has helped you resolve the htaccess, redirects, apache error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=