Redirecting your urls to a www prefix

By | April 5, 2007

Here is a sure way to ensure that your site always starts with a http://www. prefix. It doesn’t really matter as far as SEO is concerned whether a www. is better than a non www, but it still appears that at least 90% of all sites on the web start with a www.

If you use Fantastico to install your WordPress sites, you will have your url configured as http://YourSite.com and so if you want to have your site always start as http://www.YourSite.com, here are 2 ways to do it fast and easy.

1) Mod rewrite your .htaccess file by adding this piece of code to it:

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

2) Use the excellent plugin from Justin Shattuck called WWW-Redirect. Just activate the plugin and under WordPress Options > Redirect Options, choose “redirect to www” – true and “redirect index.php” – true and update the options.

Note, that if your site has already grown in backlinks and in the search engines without the www prefix, than it is best to leave it as it is, because Google still considers both types of prefixes as distinct. So your site could get a duplicate penalty hit if you tried to change the prefix all over again.

Share This:
FacebooktwitterreddittumblrFacebooktwitterreddittumblr
Category: SEO