curiouscat.comCurious Cat Code
curiouscat.com > code > .htaccess redirect

Purpose: force all page views to www... - www.curiouscat.com and curiouscat.com are different addresses (as far as Google, Yahoo... are concerned) even if they are pointing to the same page on your server. Since the quality and quality of links to your page is one factor determining how high your page will be displayed in search results spliting the links (with www and without www) to the page reduces the rank of the page. One way to help with this problem is to use a 301 redirect. And one way to do that is using the method shown below.
via: Apache htaccess Ultimate Guide. In examples below, replace domain with your domain name, for example curiouscat

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

.htaccess works like this only on Apache Linux servers with Mod-Rewrite enabled.

Note: Google webmaster central will also allow you to tell Google to consider www.curiouscat.com or curiouscat.com your primary domain. For Google that method is probably preferable but it makes sense to do both (using Google's method does nothing to tell the other search engines). Even though most sites have the same content with www... and without the www some have different content - that is why Google can't assume it is the same.

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

   

© 1996-2008   curiouscat.com      Feedback - Contact Us
Curious Cat web site by Curious Cat Creations. We can help create or improve your online presence.