When you first create a wordpress site which is not on a sub-domain, people can get to it via www.thesitename.com and thesitename.com.
While this is a good thing for being able to reach your site, it may be a bad thing as far as search engines are concerned because it appears as if you have two sites with exactly the same content.
Rewriting incoming URLs
To prevent getting penalized by search engines for duplicate content, you will need to re-write the urls on your website.
Note: Wherever "yourdomainname" is used below, it means the entire domain name…such as privateerwebsolutions.com or something.org or whatever.net.
Method 1: Using WordPress General Settings
The simplest method I have found for doing this is to use WordPress itself.
- Login to WordPress
- Go to "Settings" : "General"
- Add www. to the "WordPress address (URL) entry before your domain name (right after the http://)
The result should look like http://www.yourdomainname - Add www. to the "Blog address (URL) entry before your domain name (right after the http://)
The result should look like http://www.yourdomainname - Select "Save Changes" to save your changes.
Note that doing this will log you out of wordpress and you will need to log back in.
Method 2: Using URL Rewriting
Another way to do this is to update your sites ".htaccess" file to force all links incoming without the www to be rewritten with the www. To do this, you will need to edit your .htaccess file and add something like the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain
RewriteRule (.*) http://www.yourdomain/$1 [R=301,L]
This should be placed inside of an <IfModule mod_rewrite.c> section.
The first line tells it to enable the rewrite engine.
The second line notes to only carry out any following rules for the specified domain.
The third line notes that for everything following the domain name, rewrite it with a www in front of the domain and do a 301 redirect then stop any further rewriting.
For example, if done for this site it would look like:
RewriteCond %{HTTP_HOST} ^privateerwebsolutions.com
RewriteRule (.*) http://www.privateerwebsolutions.com/$1 [R=301,L]
Testing your changed blog URL
To test your changes, go to http://yourdomain/ and see if you end up at http://www.yourdomain/. If you do, everything is good.










[...] Rewriting URLs to avoid being penalized for dual search entries [...]