Learn‎ > ‎2. Attract‎ > ‎1. Optimize Overview‎ > ‎

2.0. How do I set up a 301 redirect?


Avoid Google "Double Vision"

From the perspective of Google and other search engines, www.yourdomain.com and yourdomain.com are two different web sites. This has the effect of splitting SEO credit--and authority--between these two versions of your site URL. Since you spend significant time and effort improving your website, you want all the credit to go into one website address.

The proper way to do this is redirect visitors from yourdomain.com to www.yourdomain.com. If you do this, Google and other search engines will not suffer from "double vision." Instead, you will get concentrated credit for your website optimization efforts.

The technical name for this problem is "URL canonicalization," but the solution is simple. Simply tell your webmaster that you want a "301 redirect from yourdomain.com to www.yourdomain.com." All major web servers and hosting companies will know what you mean and be able to accommodate your request. Many popular domain registration services enable you to make this change yourself on your domain name control panel.

Website Grader tools check for this issue and highlight any errors in the Website Grader report. You can also test whether you suffer from this problem by opening your web browser and navigating to http://yourdomain.com. If the address in your web browser updates to http://www.yourdomain.com, your site does not have a canonical URL error and no further action is required. If the address remains http://yourdomain.com, you have a canonical URL error and should fix it.


Solving URL Canonicalization on Apache 

 It's really easy to fix this issue on an Apache. All you need to do is edit your .htaccess file in your root directory and add the following.

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

This example would make all traffic to yourdomain.com be redirected with the www at the beginning.

Solving URL Canonicalization on IIS 

Solving a URL Canonicalization issues on IIS is a little bit more difficult than Apache, but still not very bad and easy enough to resolve in less than five minutes. Instead of rewriting a tutorial this article will provide you with the information that you need.

Solving Canonicalization with IIS with SEO friendly 301 redirects

Comments