Redirect to www with .htaccess

Written by Shawn S on July 16, 2008

www Redirect to www with .htaccessDid you know there are likely four ways to access your site’s home page? It’s not a good thing but you can eliminate the problem by using a redirect to www with .htacess.

Most likely, your site can be accessed through each of the following URLs:

http://www.yourwebsite.com
http://yourwebsite.com
http://www.yourwebsite.com/index.php
http://yourwebsite.com/index.php

Now, we can’t control how other people link to our sites and often times we may forget ourselves and link using varying methods. When this happens, two problems can occur. First, imagine having 100 links to your site spread out equally among the four URLs listed above. In Google’s eyes, that would be four different pages with only 25 links each. Now multiply this scenario times every page in your site. Secondly, not only do you have a backlink problem, you also have a duplicate content problem as Google is indexing multiple copies of the same page.

You’ve likely heard of the duplicate content penalty. If you’ve not, basically Google gives the most value to the original bit of content. Subsequent content which is identical to the original is given a lesser value. To fix this problem, you need to canonicalize your site. This is just a fancy way of telling your server what your preferred domain is and redirecting non-preferred requests to the preferred one.

Your preference is just that… YOUR preference. If you prefer having the www, then redirect to www. I’m not aware of any valid data that shows an SEO advantage for selecting one way over the other.

You can prevent Google from indexing multiple copies by using Google Webmaster Tools. If you have submitted your site to GWT, go to your dashboard and click on your domain name. In the left sidebar, click on “tools”, then click on “set preferred domain”. Here, you can choose between www or no www. This solution only works for Google’s index though. It does nothing to solve the problem for other search engines. To do this, you need to tackle the problem in your .htaccess file.

To redirect to www for all Internet traffic, you need to modify your .htaccess file by adding a bit of code (this code is specifically for servers running PHP). Your .htaccess file is located in the root folder of your domain in your hosting control panel. Open your hosting control panel and find a file named .HTACCESS. If you cannot find it, contact your host. Open up your .htaccess file and edit it. The method to do this will vary with differing control panels, but you should be able to click on the file and then click on a link to edit or open the file. Once you have the file open, copy and paste the following code to a blank line and save the file. Now you should be able to type in all four of the URLs listed above and end up at http://www.yourwebsite.com every time. Try it and see.

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/ [NC]
RewriteRule ^(.*)index.php?$ http://www.yourdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule (.*) http://www.yourdomain.com/$1 [L,R=301]

NOTE: DO NOT FORGET TO REPLACE YOURDOMAIN.COM WITH YOUR SITE’S NAME AND EXTENSION (.COM,.NET,ETC.)!

The above code is to redirect to www. For a redirect to non-www, enter the following instead:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php?\ HTTP/ [NC]
RewriteRule ^(.*)index.php?$ http://yourdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.yourdomain\.com [NC]
RewriteRule (.*) http://yourdomain.com/$1 [L,R=301]

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • StumbleUpon
  • MisterWong
  • Technorati
  • Reddit
  • Slashdot
  • Furl
  • YahooMyWeb
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Firefox Add Ons: SEO for Firefox

Written by Shawn S on June 15, 2008

seoforfirefox Firefox Add Ons: SEO for FirefoxIf you’re a webmaster, you want to see your site as high as possible in the search engine results pages. The higher your site gets, the more traffic you can expect, and obviously more traffic leads to more buyers. Without traffic, it doesn’t matter how pretty your site is or how valuable the content is, as you just aren’t going to make money online without traffic.

How do you move your site higher in the SERPs? You have to beat out all those sites in front of you. In order to do this, you need to analyze your competition and understand why they are being ranked where they are. A great webmaster tool that I use to help me analyze my competition is SEO for Firefox, a free Firefox add on that displays lots of great analytical information within your Google search results. For example, if you are targeting a keyword phrase such as “fuzzy widgets”, you can turn SEO for Firefox on then do a Google search for fuzzy widgets. Under each result, SEO for Firefox will display supplemental information about each site.

What will it show you? You will see Google’s PageRank, the age of the domain, number of pages indexed by Google, number of backlinks to the domain according to Yahoo, number of backlinks to the particular page according to Yahoo, number of bookmarks in Delicious, number of DMOZ entries, Alexa rank, and more. Using this information you can get an idea of what it may take to get your site to the front page of Google.

You can download both Firefox and SEO for Firefox and watch a great tutorial video at SEO Book. If you don’t have Firefox, I highly suggest using it if you’re going to be a serious webmaster as there are lots of great add-ons to help you succeed with your business. Install, watch the video tutorial and dominate the rankings!

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • StumbleUpon
  • MisterWong
  • Technorati
  • Reddit
  • Slashdot
  • Furl
  • YahooMyWeb
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...

Welcome to Net Biz Whiz!

Written by Shawn S on May 14, 2008

Welcome to my new blog I call Net Biz Whiz. This isn’t any reference to me thinking I am some Internet marketing guru making millions of dollars a year. It is simply a catchy title of what I intend to be a journal of my experiences in Internet marketing and my progress toward reaching my goal of ditching my day job and working from home by finding ways to make money online.

I will include tips and reviews along the way about things that have worked for me as well as those that haven’t. There is a lot of Internet marketing junk out there, so if I can help someone find a good product or service, or just prevent them from spending money on something worthless, then I’ll post it here so that others may benefit.

I began my Internet marketing journey a little over a year ago as an AdSense publisher. Unfortunately, I’ve never made much money at all through AdSense, but a few months ago I found a couple programs I think show some definite promise… City America and Build a Niche Store (or BANS). I am currently in the development stages of my sites and I will begin reporting my results with each of these very soon.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • StumbleUpon
  • MisterWong
  • Technorati
  • Reddit
  • Slashdot
  • Furl
  • YahooMyWeb
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Posted in: General

No Comments

© 2008 - Net Biz Whiz