January 31st, 2007

Redirecting to WWW

If you're new here, you may want to subscribe to my RSS feed or email alerts. Thanks for visiting!

If you own your domain, you must have noticed that your site resolves to your domain with or without the ‘www’ prefix. So basically, visitors can come to your site either way. Does that affect your Google juice because does it treat it like two separate domains? I have seen referrals from both in my Mint and wished I could redirect it to just one address for simplicity reasons at least. Google prefers you specify your preferred domain name so as to help them determine PageRank more accurately.

I found a simple solution on John Chow’s website. You have to modify your .htaccess file and add the following code:

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

Change ‘ipatrix’ to your domain. This change redirects anyone coming to ipatrix.com to www.ipatrix.com.I made the changes to my .htaccess file and it worked like a charm. If you use the Performancing Plugin in Firefox to write your posts, you might want to reconfigure the setting to include the ‘www’ prefix.

Update: I just noticed that this fix doesn’t really work for individual posts. For e.g if you had a page http://domain.com/post-name, the above code redirects it to the main page i.e. http://www.domain.com instead of http://www.domain.com/post-name. Since I am not sure how the above code can be modified, I suggest you use Enforce WWW Preference plugin. This will use whatever preference you specify in your blog URL settings.

Tweet This Tweet This Post!| Article Tags >> | |

Related Posts

If you did not find the information you were looking for or were not satisfied with this post then you might want to read the following related posts:

Recent Popular Posts

4 Comments

Popular Tags


Recent Comments

  • Patrix: Logically speaking conservatives should love
  • Patrix: Exactly. Right now, as it
  • Amit: Actually, conservatives love legal immigrants
  • Ashwin: I agree with the points
  • Arunk: True. I was just commenting
  • Patrix: I'm not so much commenting
  • Arunk: Democracy itself - is it
  • Patrix: Other failed states either don't
  • Patrix: Nearly 3 out of 5
  • Mambalam Mani: I was thinking of the
  • Archives

    Categories


Search this site

 (Help)

as   
include results from
sort by

Jump up to the Main Content