Lately i was reading about HTTP and i came across URL Rewriting and URL Canonicalization.
I read that the URL canonicalization error occurs when the same web page is able to be loaded from multiple URLs like:
http://www.example.com/index.php
First of all, who determines that typing http://example.com will automatically redirect to http://www.example.com?Is it a setting in my hosting company's server?
Secondly, does the link rel="canonical" solves the problem? For example inserting the code below inside the head part of the page http://www.example.com/index.php
<link rel="canonical" href="http://www.example.com" />
And if this solves the problem how can i check that this is working correctly? Will i see a change of URL from http://www.example.com/index.php to http://www.example.com ? Because i did it and i didnt see any changes.
Is the 301 redirection through .htaccess file better than rel="canonical" solution?
If i rewrite (through .htaccess) the http://www.example.com/index.php into http://www.example.com , will this be a solution (regarding duplicate contents)? Cause to me, rewriting looks more like a visual change rather than anything else.
Thanks in advance.