My previous article touched upon canonical issues for your site. Today, we are going to look at how to set up a 301permanent redirect to tell search engines that a page has permanently moved from one location to another.

Assuming that you’ve gone through the previous article on canonical issues, you would either want to redirect your WWW version on your domain URL to the Non-WWW version, or visa versa.

Below is the code you need to put in your “htaccess” file to redirect non-www to www version

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

Below is the code you need to put in your “htaccess” file to redirect from www to non-www version

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

Note – Make sure to replace “example” with your domain name

If you found the above method too complicated or if you’re not comfortable with messing with codes, an easier method is doing this from your cpanel, which should be provided by your webhosting company

1. First of all login to your C-panel and search for the icon with “redirects” as shown below and click on it.

Redirection1

2. In the page that opens choose the domain you want to redirect then choose “only redirect with www” if you want to use domain.com and choose “do not redirect www” if you want to use www.domain.com and type the website that you want to use in “redirect to” field and click “add”.

Cpanel Redirection

You need to remember that 301 permanent redirect is the preferred method of redirection for search engines. If you’ve built up links to both versions of your site you can use the permanent redirect to direct all your links and traffic on one variation of your domain; you may experience an overall ranking increase.

If you found this post useful and think that this post helped you, please vote for us and spread the love. You can also rate the post to give us feedback