Canonicalization is the method used to setup your web server so that it picks the best URL when there are several choices. This usually refers to the home page of a website. For example, most people would consider the URLs sevenacross.com, www.sevenacross.com, www.sevenacross.com/index.html all the same URL. However, as far as your web server is concerned all of these are unique and different URLs. Using canonical URLs you can merge all of these so that your web server treats them all the same in a web browser. This has a positive impact on search engine optimization. Not using canonical URLs has a negative impact on your SEO, as Google notices that several URLs are returning the same content and penalizes you.
What is a Canonical Domain Name?
Canonical domain name is the full form of CNAME. You might have encountered this term while setting up your domain name. CNAME is an entry, which is a part of your domain's DNS records. A computer hosting a website has an IP address, which is used to access the content over the web. DNS helps us avoid distributing numeric IP addresses to people and handles the conversion from domain names to IP addresses. This is pretty straightforward when you have one website being served by an IP address. However, you might want to serve various websites with the same IP address and the same domain name. This can be done using subdomains such as forums.sevenacross. The subdomains are handled by the domain's CNAME records.
Many hosting services atomically add a CNAME entry for the subdomain www so that people accessing your website as sevenacross.com or www.sevenacross.com are both directed to your site. This might seem like a good idea and quite helpful, but it's not really a good thing. Google sees two copies of everything and you lose points on the SEO front. Let's see how to fix this issue.
Fixing the Problem
Remember to edit the code shown above and replace the domain sevenacross.com with your own domain. Save the file. You will need to restart your web server if you chose the method where you edited the httpd.conf file. The code above takes all requests to your website that come with the access beginning with https://sevenacross.com and redirects them to https://www.sevenacross.com. This works for all sub-URLs as well. So if a user types the address https://sevenacross.com/photos/albums.php she will be automatically directed to https://www.sevenacross.com/photos/albums.php. All this while keeping Google happy.
Fine Tuning
There might be a scenario where you want to use your website without the www at the beginning of the domain. You would need to modify the code above slightly to make that happen:
You can apply a similar method to redirect your users to a home page. Say you want all users access the address https://www.sevenacross.com/index.php to be redirected to https://www.sevenacross.com You can redirect users to this address automatically by adding the following configuration to your Apache configuration file:
You can replace index.php with anything else. You might want to change the extension to .html or .asp, or to home.php. Make sure you run a check of the settings after you apply them. A pretty simple fix for a potentially big SEO headache.