Virtual Solutions : Main : Blog : January 2010 Archive

Print Page Email Page Bookmark Page

Archive for January, 2010



Force URL to use www



Thursday, January 28th, 2010

Here is a quick and easy solution to those who want to force all URLs to lead with www. For example, rewrite http://yourdomain.com as http://www.yourdomain.com. There are those that argue that is it is more SEO optimized to do this. To do this, add the following to your top (root) .htaccess file (or create one if it does not exist already):

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

$1: RewriteRule backreference – requested directory/file passed to rewritten URL
R=301: Permanent Redirect – 301 redirect is the most efficient and SEO Friendly method for redirection.
L: Stop the rewriting process here and don’t apply any more rewriting rules.




© Copyright 1997 - 2010 Virtual Solutions. All Rights Reserved.

Virtual Solutions Blog is proudly powered by WordPress
Page took 15 queries. 0.461 seconds


Valid XHTML 1.0 Transitional Valid 								CSS!