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 28th, 2007, 11:29 PM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 64 zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 40 m 18 sec
Reputation Power: 4
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, 05:05 AM
ClickyB's Avatar
ClickyB ClickyB is offline
Cool bra. Go with Christ!
SEO Chat Demi-God (4500 - 4999 posts)
 
Join Date: Mar 2004
Location: Gloucester (South West UK).
Posts: 4,544 ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Months 2 Weeks 3 Days 12 h 41 m 12 sec
Reputation Power: 115
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 / SeoChat? Start : Here
Forum Rules & Posting Guidelines
Canonicalisation Solutions

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

Reply With Quote
  #3  
Old June 29th, 2007, 01:41 PM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 64 zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 40 m 18 sec
Reputation Power: 4
Thanks I will try that out. Is there a way to determine if its actually working?

Reply With Quote
  #4  
Old June 29th, 2007, 08:46 PM
ClickyB's Avatar
ClickyB ClickyB is offline
Cool bra. Go with Christ!
SEO Chat Demi-God (4500 - 4999 posts)
 
Join Date: Mar 2004
Location: Gloucester (South West UK).
Posts: 4,544 ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level)ClickyB User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Months 2 Weeks 3 Days 12 h 41 m 12 sec
Reputation Power: 115
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, 10:00 PM
zoddy zoddy is offline
Contributing User
SEO Chat Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 64 zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level)zoddy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 40 m 18 sec
Reputation Power: 4
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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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





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