Google Optimization
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   SEO Chat ForumsGoogleGoogle Optimization

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread SEO Chat Forums Sponsor:
  #1  
Old June 29th, 2007, 12:29 AM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 42 zoddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 25 m 36 sec
Reputation Power: 3
Htaccess www to non www

I hear its a good idea to pick your preferred domain in google webmaster tools and also to redirect one to the other via htaccess such as the example below

Here is the code you should use if you want people to redirect from WWW to non-WWW:
(for example, if someone types in http://www.domain.com, it will forward to http://domain.com)

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

In both cases, make sure to replace “domain” with the URL of your domain.

My question is this, I have a wordpress blog inside a subdirectory. Do I have to do anything different with the root htaccess file or will it just flow through my site.

Second when it comes to wordpress I have a htaccess file in the and in the blog directory, do i have to enter it in both?

Thanks

Reply With Quote
  #2  
Old June 29th, 2007, 06:05 AM
ClickyB's Avatar
ClickyB ClickyB is offline
Scru u guys I'm goin home
SEO Chat Specialist (4000 - 4499 posts)
 
Join Date: Mar 2004
Location: Gloucester (South West UK).
Posts: 4,016 ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 22 h 7 m 37 sec
Reputation Power: 54
Hi Zoddy,

First of all, the "normal method" would be to redirect from "non-www" to "www" ('though it's not really important because what you're doing here will create your "standard").

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

Here's the same thing for "2-part tld's":

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

Just select the relevant one and put it in the .htaccess file at your domain root and it will work for the entire domain (including subfolders).
__________________
ClickyB
"The quality of the visitor is more important than the volume".. Egol 22nd Feb 2008
New to SEO? Start Here: SEO FAQ
Forum Rules & Posting Guidelines

Last edited by ClickyB : June 29th, 2007 at 06:09 AM.

Reply With Quote
  #3  
Old June 29th, 2007, 02:41 PM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 42 zoddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 25 m 36 sec
Reputation Power: 3
Thanks I will try that out. Is there a way to determine if its actually working?

Reply With Quote
  #4  
Old June 29th, 2007, 09:46 PM
ClickyB's Avatar
ClickyB ClickyB is offline
Scru u guys I'm goin home
SEO Chat Specialist (4000 - 4499 posts)
 
Join Date: Mar 2004
Location: Gloucester (South West UK).
Posts: 4,016 ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level)ClickyB User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 22 h 7 m 37 sec
Reputation Power: 54
Quote:
Originally Posted by zoddy
Thanks I will try that out. Is there a way to determine if its actually working?
Yes... and you're gonna kick yourself when you read this

1. Back up your .htaccess file.
2. Add the code.
3. Upload the .htaccess file.
4. Try to access your domain index with "www".
5. Try to access your domain index without "www" (you should automatically be forwarded to the same url "with www").
6. Try to access a url deep inside your domain without "www" (you should automatically be forwarded to the same url - "with www").
7. If it doesn't work correctly, re-upload the original .htaccess

Reply With Quote
  #5  
Old June 29th, 2007, 11:00 PM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 42 zoddy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 25 m 36 sec
Reputation Power: 3
well i tried both versions up top and it kind of works.
The main page that doesnt have the blog at the root works great. You can type in domain.com and you are redirected to www.domain.com

However the blog doesnt redirect it either does one of two things depending on which code I use above

1. I tried it with a deep embedded post and all it does is redirect me to the index page
2. Or it does nothing at all


Reply With Quote
Reply

Viewing: SEO Chat ForumsGoogleGoogle Optimization > Htaccess www to non www


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT