Welcome to WebmasterWorld Guest from 54.158.228.55

Message Too Old, No Replies

301 Redirects, www and Non-www

What should we do - what can we expect?

     
7:28 pm on Jul 6, 2005 (gmt 0)

10+ Year Member



There's been a lot of talk about using a 301 redirect so there aren't two versions of your site out there (www.widgets.com and widegets.com) - I believe it is also a way to avoid being hijacked. It seems like everyone is doing it now.

I have a couple things I would like to clarify on 301's via this example:

A site currently has no redirect - google sees both widgets.com (PR 7) and www.widgets.com (PR 6).

It seems like this site should do a 301 redirect to widgets.com (the higher PR ranking).

Here are my questions:
1) Might this give the site an overall boost in PR?
2) What is the short-term effect of making this change (could it change your rankings and for how long)?
3) Is www. better than non-www?

Also, if you recently made this change yourself - how did it go? Thanks for your help!

10:44 am on Jul 21, 2005 (gmt 0)

10+ Year Member



I have the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]

ErrorDocument 400 /errordocs/400.php
ErrorDocument 401 /errordocs/401.php
ErrorDocument 403 /errordocs/403.php
ErrorDocument 404 /errordocs/404.php
ErrorDocument 500 /errordocs/500.php
ErrorDocument 501 /errordocs/501.php
ErrorDocument 502 /errordocs/502.php

And if i try to go to [mydomain.com...] nothing happens? I just get Internal Server Error, Apache/1.3.27

[edited by: ciml at 7:00 pm (utc) on July 21, 2005]
[edit reason] Space missing from RewriteCond [/edit]

2:42 pm on Jul 21, 2005 (gmt 0)



Catnip, did you ask your hosts about that? If you're using exactly what I posted as I indicated, it should work unless those lines of "ErrorDocument 400 /errordocs/400.php" have something to do with it, I am unfamiliar with those. My Apache version is 1.3.33 which is a little later than 1.3.27, so that MIGHT (and I emphasize "might") mean something but I would think that would still work on your version.
4:11 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Ask your hosts if Mod_Rewrite is enabled.

They might not have set it up.

5:51 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There also needs to be a space between these }!
6:12 pm on Jul 21, 2005 (gmt 0)



Like this?

RewriteCond %{HTTP_HOST}space!^www\.MyDomain\.com

6:32 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



THANK YOU! It was the space that was causing the error :). Just checked the header...

HTTP/1.1 301 Moved Permanently
Date: Thu, 21 Jul 2005 18:33:37GMT
Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSS
L/0.9.7d PHP/4.3.1-dev
Location: [MyDomain.com...]
Connection: close
Content-Type: text/html; charset=iso-8859-1

Ryan

7:20 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The stuff in .htaccess is not tolerant of even minor typing errors.
12:07 pm on Jul 22, 2005 (gmt 0)



Strange, I checked those lines in my htaccess file and I DO have the space in mine and the space is also in what I pasted into the previous page.

Catnip, you had the space in yours in what you posted above, I guess you lost the space when you pasted it into your htaccess file.

12:51 pm on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This board eats spaces in front of exclamation marks. To keep spaces, use two or three of them and enclose the code snippet in [pre] or [code] tags
1:22 pm on Jul 22, 2005 (gmt 0)



But what I'm saying above is it did NOT eat the spaces, the space appears in what I pasted (and what Catnip pasted) in our posts between the } and the! mark.

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com

There is indeed a space between those there, so he must have lost it when he pasted it (or maybe he manually typed it) into his htaccess file. I see what you're saying though since I previewed this post and there is no space where I now marked in blue above. Yet, the spaces do appear in the htaccess lines.

1:27 pm on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I got one of the moderators to re-edit all of the posts in this thread so that future readers always see correct information. For a while, the space was missing in all examples here.

You can see the moderator tag, with date and time, at the bottom of each post (#49, #54, #61).

[edited by: g1smd at 1:28 pm (utc) on July 22, 2005]

1:28 pm on Jul 22, 2005 (gmt 0)



Ahhhh. That explains it!
12:26 am on Aug 2, 2005 (gmt 0)

5+ Year Member



Hi all,

Just on this topic. I am trying to redirect an old site over to a new server.

Problem is that the old site has {QUERY_STRING} parameters attached to the end of the main url which is severely interfering with se results.

So the domain [mydomain.com...] in google appears as [mydomain.com?page_id=13537....]

See [google.com.au...] to see what I mean. Should be the first entry. (Actually not sure if allowed to add this. Not a direct link is linked to google - anyway delete if shouldnt have)

I have gotten rid of all the other query string pages and this is the only one left but obviously the main one.

I am confused how to add the query string in the redirect code into .htaccess. When I try through Cpanel it doesnt work - it actually looks like it sends it into a loop.

Just wondered what the actual code would be.

12:55 am on Aug 2, 2005 (gmt 0)

5+ Year Member



should add what i have tried:

redirect 301 /?page_id=13537 http://www.example.com.au/

and

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

Various other options too, but nothing has worked so far.

1:20 am on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If none of your pages use a query string that needs to be displayed now, this should work:

RewriteCond %{THE_REQUEST} \?.+\ HTTP/ [NC]
RewriteRule (.*)$ /$1? [R=301,L]

For more information, please see the Apache Forum [webmasterworld.com].

Justin

1:42 am on Aug 2, 2005 (gmt 0)

5+ Year Member



Ok. Sorry new here didnt see that part of the forum. I might move over to there as this post is pretty lengthy now.

Ahh. Dont seem to be able to edit the above posts anymore.

5:36 pm on Aug 5, 2005 (gmt 0)

10+ Year Member



I am thinking about doing this on my site. The Redirect Code in this thread seems to work fine and returns the 301 code when checked.

Before I implemented this I thought I would check some big sites to see what they are doing. Google redirects non-www to www but a server header checker returns the 302 code. Apple also returns the 302 code.

What's up with that?

9:35 pm on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>> What's up with that?

Sloppiness and ignorance. It's just like when some major sites only work in IE or their HTML don't validate.

3:17 pm on Aug 9, 2005 (gmt 0)

5+ Year Member



Hello, this is my first post but I have been reading the information on Webmaster World for a while. My site's rankings for a lot of keywords have fallen since the last Google update. From what I've read, I believe it is because Google is seeing widgets.com (PR1) and www.widgets.com(PR4) as duplicate content.

My hosting company said they can't do a 301 redirect from widgets.com to www.widgets.com but they can disable widgets.com. Would this resolve our duplicate content problem?

Any help is greatly appreciated.

9:49 pm on Aug 9, 2005 (gmt 0)

WebmasterWorld Senior Member steveb is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Get a new host.
11:23 pm on Aug 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



steveb's advise isn't too bad.

Would this resolve our duplicate content problem?
One significant advantage a 301 redirect offers is that the Page Rank associated with the existing links pointing to either version of your domain name will eventually be consolidated into a single PR value. This can provide a nice boost to your PR.

Simply disabling one version will break those links and you will lose the PR associated with that version. And you may lose a considerable number of those links eventually too, if webmasters decide it's easier to delete your link than to correct it...

12:17 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



What I find interesting is that there are so many high ranking sites, obviously very scraped, with apparent hijack attempts against them and with lots of non wwws pointed at them that do no such redirection and they are tops on their keywords in the serps. Other than google, I really haven't found high ranking sites that redirect. I'm also seeing a lot of sites that have the pr split between both the www and non www - some have 6 on each, which seems odd giving that you can only have 10 total. A lot of these sites do do some absolute linking.

Why does the non www and www issue affect some but not apparently most high ranking sites? Are people just being neurotic about "split PR" on the urls or do people believe this is effecting their rank? If this were causing duplicate content penalties why does it not affect so many?

7:28 pm on Aug 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You've posed some broad questions that have been discussed at length. I'll address a few of the easy ones. :)

I'm also seeing a lot of sites that have the pr split between both the www and non www - some have 6 on each, which seems odd giving that you can only have 10 total.
Are people just being neurotic about "split PR" on the urls or do people believe this is effecting their rank?
The key thing to understand is that www.example.com is a sub domain of example.com. Historically, Google has always treated them as two unique domains and sites. So either or both could acquire a PR of up to 10. PR advances on a logrithmic scale so combining the PR from both domain versions could push a PR6 to a PR7, but it's unlikely to push it much higher.

Why does the non www and www issue affect some but not apparently most high ranking sites?
If this were causing duplicate content penalties why does it not affect so many?
These questions have been debated to death. Unfortunately, Google is the only source for a definitive answer and they're not sayin' much.

Similar questions have been discussed for a very long time, you can find some history in #11 at [webmasterworld.com...] to get a sense of the scope of the problem although it was first discussed in '01 or early '02 if memory serves. Eventually it became known as the "canonical page" problem. At [webmasterworld.com...] experienced folks were invited to suggest ways to prevent and avoid canonical problems and many of those techniques were subsequently endorsed by GoogleGuy.

Do some reading and perhaps you'll develop your own theories or find your own answers.

4:47 pm on Aug 11, 2005 (gmt 0)

5+ Year Member



Thanks for the advice Dave and Steve, I have a few other questions.

1. If we decide to still get rid of the non-www version of our site (we don't have many links to it) will this cause a problem or penalty the next time Google tries to crawl our www site?

2. I noticed on some of our competitors sites, it doesn't look like the non-www version of their site forwards to the www version because the address bar isn't changing. But when you look at the cached version of the non-www page, it is actually the chache of the www page. Any idea how/why this is happening?

Thanks again for your assistance.

7:33 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



decide to still get rid of the non-www version
If you "get rid of it," your server should return a 404 error code for the non-www version of your domain name. If it does, that version should move to Google's supplemental index, then eventually be dropped from the entire index with no impact to the www version. (If it doesn't return a 404, get a new host!)

when you look at the cached version of the non-www page, it is actually the chache of the www page
How can you tell? :) Assuming the sites you're looking at are behaving like your own site (no cloaking or redirects), visitors that request EITHER www.yourdomain.com OR yourdomain.com are being served the same page/file. There is only one HTML file, it is simply being accessed using two different addresses/domain names.

because the address bar isn't changing
There are many ways to do redirects and many different reasons for doing them. Some change the address bar and some don't.
4:43 am on Aug 13, 2005 (gmt 0)

10+ Year Member



I checked my .htacces file and had not done that for a long time.

Found this and would like to know what it does. Anyone?

----------------------------------------------------
<Files .htaccess>
order allow,deny
deny from all
</Files>
DirectoryIndex index.php index.html index.htm
----------------------------------------------------
IndexIgnore *

5:40 pm on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We're getting way off topic (and this question would be more appropriate for the Apache Web Server Forum. Next time. :) )

<Files .htaccess>
order allow,deny
deny from all
</Files>
This set of directives instructs your server to NOT serve your .htaccess file to surfers.

DirectoryIndex index.php index.html index.htm
This one specifies your default index page. A "domain name only" request will prompt your server to look for index.php, then index.html, then... It will serve the first one it finds.

IndexIgnore *
I've never used this one. The Apache manual says, "The IndexIgnore directive adds to the list of files to hide when listing a directory." I think this is being used to prevent surfers from being able to see a list of the files in your directories. In my experience, the Options directive is most commonly used to do this as in:
Options -Indexes

The Apache directives for V 1.3 are indexed here [httpd.apache.org] and the V 2.0 directives are here [httpd.apache.org].

8:52 pm on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. If we decide to still get rid of the non-www version of our site (we don't have many links to it) will this cause a problem or penalty the next time Google tries to crawl our www site?

No, it will not cause a problem or penalty with Google - it will cause a problem for your surfers.

If you disable the domain and serve 404's for everything, anytime a surfer types in your URL and forgets to type www. first, they will also get a 404 - The converse is also true if you disable the www. and a person types that in.

Please, get a new host - I bet there is one listed at the bottom of this page that could help you out for under $10 / month.

Personally, I believe disabling a version of the domain is far from a wise decision... The purpose of a redirect is to use only one domain, but allow people who access the wrong one to be redirected to the right one. If your hosting company cannot do this simple task, why host with them?

Justin

9:47 pm on Aug 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would this resolve our duplicate content problem?
Yes, eventually.

Apologies Sam1234, nobody directly answered your question, although I intended to in #81. After reviewing it today... (We need a smiley with a RED face!) :)

11:57 am on Aug 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Been away from this thread for a while - great answers Dave :)
This 130 message thread spans 5 pages: 130
 

Featured Threads

Hot Threads This Week

Hot Threads This Month