How to Attract more Visitors with htaccess

May 2nd, 2008 dawhoo Posted in Internet Technology, Search Engine Optimization |

Increasing your SERP position with some simple htaccess edits

Take a look at the address bar of your webpage. Is it http://www.yoursite.com or http://yoursite.com? If your website’s URL begins with www.your… then try removing the www. If your address bar shows http://your… try adding www. after the http:// Did the URL change? Can you see both the www. version and the non www. version in the address bar? If so, you may have a problem.

To maximize search engine results, you do not want to be able to see both the canonical version (http://www.yours.com) and the non-canonical (http://yours.com) versions of you URL in your browser’s address bar. While http://www.site.com and http://site.com may look the same in the browser, to search engines, those are two separate pages and each version has its own unique page rank. You could be splitting your page’s rank by having both version available on your website.

We all know that backlinks to your site are a good thing and having your site indexed by the search engines is an enormous step to increase your position SERP, but when you are using both the www version and the non-www method to access your website, you are not only splitting the page’s rank, you are also splitting the number of backlinks to your site. If your site shows both the www and the non-www version in you website, check out how many backlinks are in the different versions. You can use the backlink checker I have here or you can find one on the web. Did you notice there are different backlinks? Ouch - you need to fix that now to make sure you are getting the most out of your backlinks.

Here’s what to do, add the code below to your .htaccess file in your web site’s root folder. Be sure and substitue “domain” with your domain. This will automatically forward http://domain.com to http://www.domain.com

To make your site always use www, use this code

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

If you would rather have your site without the www, use this code

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

You will need an FTP client to upload the file and a plain text editor, such as notepad, to edit the file. Word, Works and other word processing editors WILL NOT WORK for editing .htaccess files Additional characters and formatting are added in word documents and using one of these to edit your .htaccess file will very likely cause your htaccess file to fail.

If you don’t already have an .htaccess file in your web root, you can create one, but you need to be very careful creating htaccess. Did you notice, the file name is .htaccess ? If you are using a Windows computer, you’re going to have a little problem creating a file of that naming convention under windows. Windows does not like files beginning with a “.” But that’s OK, there’s an easy way to solve that problem.

  1. Create a text file called htaccess.txt
  2. Enter the code above (being sure to substitute “domain.com”)
  3. Upload the file using your FTP client as an ASCII file*
  4. Edit the file name on the server (change htaccess.txt to .htaccess)
  5. Enjoy!

Now check the non-www version of your website. You should see it automatically changed to the www version. This may sometimes take some time to go into effect, but rarely should it take longer than 24 hours to see the change. If after 24 hours, you haven’t seen a change, check to make sure you edited the .htaccess correctly.

* .htaccess must be uploaded as ASCII, otherwise, the file won’t work. All plain text files are ASCII and more than likely, your FTP client will recognize the file type if you uploaded the file as htaccess.txt If you uploaded the file as .htaccess, but sure to make sure your FTP client is set to ASCII transfer and NOT BINARY

http://www.yoursite.com vs http://yoursite.com

Is there a difference between having www and not having www in the URL? I don’t think so. Check out Google (http://www.google.com), you will notice their URL always has www in it, the same is also true for Yahoo (http://www.yahoo.com). Those are two very highly ranked web pages and they both use the www in their URL. Now, check out digg.com, which is a very high ranking social networking web site. . Digg uses the non-www version (http://digg.com) and it sure doesn’t seem to effect their page rank. It’s not really too important which version you use as long as you are consistent. If most of the backlinks to your site use www, then definitely use the www version on your site. If you have more backlinks using the non-www version, you will want to change your .htaccess to use the non-www version.


One Response to “How to Attract more Visitors with htaccess”

  1. [...] View post:How to Attract more Visitors with htaccess [...]

Leave a Reply