Welcome Buddy!

Get Started
Blogging & SEOTips Tricks

Canonical URL: How To Set Preffered Domain www or non www

Canonical URL, www or not?

Many bloggers/webmasters have known about this canonical URL issues, canonical pages, and canonical tag pagination, but there are some who don’t know or maybe wondering what is preferred domain, how to set this up and what is the advantage of using WWW prefix or without it. I was wondering what I want to write in this blog about SEO for the first time. So I decided to talk about the preferred domain or canonical URL for the homepage. What to do if we change the previous canonical URL. Well, I don’t know if there is an advantage using the WWW prefix or without it. But the problem is when you want to change your previous preferred domain into WWW or without WWW and you need to make standard URL to make sure you don’t get penalized because of duplicated content. Remember that the WWW and the non-WWW version of a site is a different URL for the search engine. As proof their both statistics not exactly the same. Now If you only change it through your WordPress setting, many visitors from the search engine will find 404 pages unless you redirecting it using 301 server-side. So, you need to set this immediately with a simple step. I’ll explain after this to redirect using .htaccess file at the bottom of this post.

When the first time after installing WordPress, you will probably go to Dashboard==>Profile then to Setting==>General. On this page, you will find whether to set your WordPress installation directory and URL using WWW or no. Simply choose what URL you prefer to be crawled by the search engine. There is a good SEO plug-in which can set canonical URL for post or page, it will add an attribute rel=”canonical” so the search engine knows this canonical URL is an important and higher priority among other links. Even some great themes have a built-in feature about this. But the problem doesn’t stop here in case somehow you want to change your preferred domain/canonical URL for your homepage from https://yoursite.com to https://www.yoursite.com, but of course, you do not want to lose all the statistic data, indexed back-links of your previous preferred domain and search result for your site keep running smoothly.

How to Setting Up?

Now, if you have a Google account, simply go to Webmaster Tools in order to set this up. So the search engine will be synchronizing your statistic data, backlinks, and the search results and automatically detecting and redirecting your previous preferred domain into the new one. You have to verify your site ownership first by methods given. I prefer the HTML method, just upload the downloaded HTML file to your home directory, click the link and you all set and verified. If you haven’t verified your ownership before, you have to do this verification process twice. One for your https://yoursite.com and another for https://www.yoursite.com. After that, you now can set your preferred domain.

To specify your preferred domain:
1. On the Webmaster Tools Home page, click the site you want.
2. Under Site configuration, click Settings.

1canonical url
3. In the Preferred domain section, select the option you want. Then you will see this option, simply choose your preferred domain setting.
2setting preferred domain
4. Save your setting, and you will receive a message in your dashboard that your preferred domain has been updated. This process usually only takes about 5 minutes or less.
3setting canonical url

Now your site is done. All the detected backlinks, search results, and other previous advantages you have gained will still remain and synchronized. So when someone accessing your previous canonical homepage URL for example https://yoursite.com, will be automatically detected and redirected to a new preferred domain https://www.yoursite.com.

Other Search Engine?

That’s only for Google, what about another search engine? Let’s get done all by redirecting to the URL you want using .htaccess file. Open your .htaccess file in your root directory. You need to activate the directive like a mod_rewrite engine in your apache/Nginx server to make this work. Note that most of the hosting providers have set this by default and they using rewrite module for apache too, so you just need to add this couple line to your .htaccess by opening it through your CPanel =>File manager ==> show dot file.

If you want www as your standard canonical for your URL then add this:

1available ads room - 728x90
 RewriteEngine On
 RewriteBase /
 RewriteCond %{HTTP_HOST} !^www. [NC]
 RewriteCond %{HTTP_HOST} ^([^.]+.[a-z]{2,6})$ [NC]
 RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

But if you want your standard canonical URL using without www then add this line:

 RewriteEngine On
 RewriteBase /
 RewriteCond %{HTTP_HOST} !^yourdomain.tld$ [NC]
 RewriteRule ^(.*)$ http://yourdomain.tld/$1 [R=301,L]

In this case, you need to add your domain name and its extension eg. .COM or .NET or .ORG and other top-level domain names of your own. So if your site is awesomesite.com the line would be:

 RewriteEngine On
 RewriteBase /
 RewriteCond %{HTTP_HOST} !^awesomesite.com$ [NC]
 RewriteRule ^(.*)$ http://awesomesite.com/$1 [R=301,L

If something goes wrong, perhaps the rewrite engine was already on so you just have to remove the first two lines of all code above which is RewriteEngine and RewriteBase. After that save the file. That’s it you’re all set up!

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check Also
Close
Subscribe Now
Advertisement
Back to top button
Close

Adblock Detected!

If you enjoy our content, please support our site by disabling your ad blocker or whitelisting us. We use ads to keep our content happy and free.