vBulletin SEO Forums

SEO

vBulletin Search Engine Optimization

Buy vBSEO Now! HACKER SAFE certified sites prevent over 99.9% of hacker crime.
ne nw
New vBSEO Discount Level for Network Builders Meet vBSEO Team in New York (Nov. 3rd & 4th) vBSEO 3.2.0 GOLD Has Landed Success with vBSEO = 600ore Web Visitors + $1400 in a Day! Crawlability Inc. Files for SEO Technology Patent
se sw

[How to] Setup www.yourdomain.com or yourdomain.com (www vs. non-www) - With .htaccess 301 redirects

This is a discussion on [How to] Setup www.yourdomain.com or yourdomain.com (www vs. non-www) - With .htaccess 301 redirects within the General Discussion forums, part of the vBSEO SEO Plugin category; Most websites are setup to allow access via either www or non-www. Example: Code: vbseo .com or Code: www. vbseo ...

Go Back   vBulletin SEO Forums > vBSEO SEO Plugin > General Discussion

Enhancing 80 million pages.

Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Reply

 

LinkBack Thread Tools
  #1  
Old 03-16-2008, 12:44 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7
Arrow [How to] Setup www.yourdomain.com or yourdomain.com (www vs. non-www) - With .htaccess 301 redirects

Most websites are setup to allow access via either www or non-www. Example:

Code:
vbseo.com
or

Code:
www.vbseo.com
However - this can lead to duplication of your content or redundant URLs within the search engines.

For best SEO, you need to choose one version or the other, to ensure full link consistency and consensus, and to maximum crawling efficiency.

There are 2 methods of specify which version to use. One is by using your .htaccess file. The second way is to select your preferred format within Google Webmaster Tools.

Choosing to Use the WWW version of your domain ONLY

Edit your .htaccess file.
At the top, add the following new lines:
Code:
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Note: You must replace example.com with your own site URL.

Once your new .htaccess file is uploaded to the server, your site will ONLY be accessible via the WWW version of your domain.

Anytime a user or search engine tries to access the non-WWW version of your site, they will be automatically forwarded to the WWW version.

Choosing to Use the NON-WWW version of your domain ONLY
  • Edit your .htaccess file.
  • At the top, add the following new lines:

Code:
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Note: You must replace example.com with your own site URL.

Once your new .htaccess file is uploaded to the server, your site will ONLY be accessible via the NON-WWW version of your domain.

Any time a user or search engine tries to access the WWW version of your site, they will be automatically forwarded to the NON-WWW version.


Choosing WWW or NON-WWW version of your domain in Google Webmaster Tools

If you are not yet using Google Webmaster Tools, you should be. It provides a wealth of info on how to improve your site for SEO purposes.

Here is a primer on some of the key aspects you should be evaluating with your account:
Google Webmaster Tools - Recommended for All vBSEO Customers

To specify which version of your domain to use, login to your account and go to the following section:

Go to Dashboard > Tools > Set preferred domain

Quote:
Associate a preferred domain with this site, to always or never show the leading "www." in Google's search results.

Google will then ONLY list the WWW or NON-WWW version of your URLs in the index, whichever you select.


Lighttpd Webserver

Choosing to Use the WWW version of your domain ONLY

Please add the following rule to your lighttpd.conf file. In order to edit lighttpd.conf you can use the following command.

Code:
# vi /etc/lighttpd/lighttpd.conf
After editing lighttpd.conf using the vi editor, please save it and restart lighttpd.

Code:
$HTTP["host"] =~ "^domain\.com$" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) }
You can restart lighttpd with the following commands.

Code:
# service lighttpd restart
# /etc/init.d/lighttpd restart
Note: You must replace domain.com with your own site URL.

Choosing to Use the NON-WWW version of your domain ONLY

Please add the following rule to your lighttpd.conf file. In order to edit lighttpd.conf you can use the following command.

Code:
# vi /etc/lighttpd/lighttpd.conf
After editing lighttpd.conf via the vi editor, please save your lighttpd.conf and restart lighttpd.

Code:
$HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) }
You can restart lighttpd with the following commands.

Code:
# service lighttpd restart
# /etc/init.d/lighttpd restart
Note: You must replace domain.com with your own site URL.
__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.


Last edited by Joe Ward; 03-22-2008 at 06:24 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-16-2008, 04:05 PM
Senior Member
 
Real Name: Justin
Join Date: Jul 2006
Posts: 231
Thanks, I could have used this about a year ago when I first set this up on my sites lol. I'm sure this will be helpful for many users though!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 03-16-2008, 04:11 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7
Good point Justin. We'll try to do a better job of getting common questions clearly documented on the site.
__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 03-16-2008, 04:55 PM
briansol's Avatar
Senior Member
vBSEO Pre-Release TeamDesign for SEOBig Board Administrator
 
Real Name: Brian
Join Date: Apr 2006
Location: Central CT, USA
Posts: 5,476
www. is deprecated.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 03-16-2008, 05:12 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7


__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 03-17-2008, 04:33 AM
Member
 
Real Name: usekes
Join Date: Aug 2006
Posts: 70
I guess it is not a good idea for active forums, because all of my pages indexed with www. so if i drop www. it means my index will be decrease than google have to reindex new pages without www
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 03-17-2008, 12:34 PM
briansol's Avatar
Senior Member
vBSEO Pre-Release TeamDesign for SEOBig Board Administrator
 
Real Name: Brian
Join Date: Apr 2006
Location: Central CT, USA
Posts: 5,476
the htaccess rule 301's it. you shouldn't lose any ranking.

Plus, in the google webmasters portal, you can set www vs non-www right there. so even if all your links are www in there, you can have them send to non-www.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 03-17-2008, 03:11 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7
If you already have www indexed, and you are ok with that, I think you are very safe to stick with it.

We use www here and we won't be changing, even though a few of my own private sites are setup without it.

One thing we have to consider is "user behavior". It's quite common when someone types in a domain (from memory) that they may include the www part since it's been used so prominently from the early beginnings of the Web.
__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 03-17-2008, 03:29 PM
briansol's Avatar
Senior Member
vBSEO Pre-Release TeamDesign for SEOBig Board Administrator
 
Real Name: Brian
Join Date: Apr 2006
Location: Central CT, USA
Posts: 5,476
or, they type 'site' and hit ctrl + enter, which auto adds http and www and .com to it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 03-17-2008, 03:54 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7
Interesting. Good point.

One thing that has always bothered me is sites that allow one or the other, but do NOT redirect the non-preferred version.

I have seen major websites (even recently) that give a 404 error if you enter the domain without the www. part.
__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11  
Old 03-17-2008, 04:26 PM
briansol's Avatar
Senior Member
vBSEO Pre-Release TeamDesign for SEOBig Board Administrator
 
Real Name: Brian
Join Date: Apr 2006
Location: Central CT, USA
Posts: 5,476
that's because IIS sucks

oh, wait... i didn't mean to say thaty out loud
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12  
Old 03-17-2008, 07:10 PM
Senior Member
 
Real Name: Justin
Join Date: Jul 2006
Posts: 231
Quote:
Originally Posted by Joe Ward View Post
Good point Justin. We'll try to do a better job of getting common questions clearly documented on the site.
Sorry, didn't mean for it to sound like I was complaining :P You guys do a great job with presenting useful information here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13  
Old 03-17-2008, 07:23 PM
Joe Ward's Avatar
vBSEO Staff
vBSEO Total Customer SupportvBSEO Documenter
 
Real Name: Joseph Ward
Join Date: Jun 2005
Location: Puerto Rico
Posts: 19,320
Blog Entries: 7
Quote:
Originally Posted by jbartle View Post
Sorry, didn't mean for it to sound like I was complaining :P You guys do a great job with presenting useful information here.
I knew you were not complaining. But - we still have not organized all the information will have available to the level that it should be yet. We're working on it.
__________________
Joe Ward / Crawlability Inc.
vBSEO 3.2.0 Launched - Maximum Overdrive for Your Web Traffic! Over 100 Instant SEO Optimizations

vBSEO Google Sitemap Generator - Version 2.2 Released Mandatory Upgrade for vBSEO 3.2.0 GOLD

6X Traffic - $1400 in One Day with vBSEO! Imagine What the vBSEO Patent Pending Technology Can Do For You.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14  
Old 03-20-2008, 08:35 AM
Member
 
Real Name: Eric Frost
Join Date: Jul 2006
Location: LinkBliss
Posts: 77
Thanks, I did it on all my sites.. I had set the Google preferred domain, but did not have the code in .htaccess
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15  
Old 03-22-2008, 12:13 PM
AWS AWS is offline
Member
Big Board Administrator
 
Real Name: Bob
Join Date: Feb 2006
Location: Pluto
Posts: 34
Send a message via AIM to AWS Send a message via MSN to AWS Send a message via Yahoo to AWS
Just posting to make that annoying message go away at the top of the page.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Urgent help with htaccess and 301 redirects markbolyard URL Rewrite Settings 4 12-02-2007 05:24 PM
htaccess redirects when moving folder I, Brian Troubleshooting 3 10-05-2007 02:47 PM
Help with initial htaccess setup mhc1576 URL Rewrite Settings 1 12-28-2006 07:44 AM
301 redirects disabled, vBSEO still redirects to new archive PageUp Troubleshooting 6 10-23-2005 01:32 PM


All times are GMT -4. The time now is 12:12 PM.


Powered by vBulletin Version 3.8.0 Beta 3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.5 ©2008, Crawlability, Inc.