Sangam254
Sangam254

Reputation: 3483

How to solve url canonicalization?

The url http://www.example.com/ and http://www.example.com/index.html both display the same web page. But search engine treats them as 2 different urls. Hence there is a split in the page rank and affects SEO.

Possible solutions I got after web search:

1.Use DirectoryIndex index.html in the .htaccess file.

This tells the search engine that http://www.example.com/ and http://www.example.com/index.html are same.

Issue I am facing: DirectoryIndex index.html in the .htaccess file expects that all sub-folders also have and index.html file. Ex. if there is a folder "blog" in the root directory which has no index.html file in it, then the url "http://www.example.com/blog/" throws index not found error.

2.using 301 redirect. Redirect http://www.example.com/index.html to http://www.example.com/

Issue: redirections increase load time. It is not a good practice.

Please suggest which solution is better? I doubt if the 1st one is a solution or not. Also, if I have to redirect, redirecting http://www.example.com/index.html to http://www.example.com/ is better or vice-versa with regard to SEO?

Upvotes: -1

Views: 712

Answers (1)

John Conde
John Conde

Reputation: 219804

Just use canonical URLs. This will solve the problem easily. You could also do a 301 redirect from the index.html to the / if necessary as that would also accomplish the same thing.

Upvotes: 2

Related Questions