I have the following code in my htaccess: #if the domain is not www.mydomain.com RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC] #redirect to www.mydomain.com RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] Code (markup): I believe the purpose of this is for redirecting the non-www domain to the www domain (I'll call this the 'non-www code'). I was wondering if I even need this code because I have www.mydomain.com set as my hard canonical name, which I think is supposed to redirect aliases such as mydomain.com automatically (without having to code anything in htacess). So could I just do away with this code completely? I also have the following code: #leave this rule in place, but after the one above to handle the home page RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ RewriteRule ^(.*)index\.html$ http://www.mydomain.com/$1 [R=301,L] Code (markup): I believe this is in there to redirect http://www.mydomain.com/index.html to http://www.mydomain.com/ (I'll call this the 'index.html' code). I'm not sure if I could also also remove the 'index.html code' using the same logic that I gave above for getting ride of the 'non-www code'? Can I remove only the 'non-www code' and just leave the 'index.html code' by itself?
The purpose of these redirect is to tell the search engines that it is the same site to avoid duplicate content confusions, and make sure that the users/visitors go to the standard URL. So you can put multiple redirects to the standard URL of your domain.