Forum Moderators: open

Message Too Old, No Replies

Indexed with and without "www." prefix

Diluting link building + seen as duplicate content

         

millie

7:18 pm on Feb 4, 2004 (gmt 0)

10+ Year Member



Inktomi and ATW (and Google?) have indexed my site with and without "www."

I have identified 2 inbound links that don't include the "www." and I will get these changed without delay.

I can't stop this dual-personality by using a permanent redirect because they are one and the same - it's just that our server recognises both as valid domain names. Surely this is pretty standard?

SE positioning for this site absolutely sucks but used to be OK. It's as if the SEs are steering clear of duplicate content.

If I view the Google cache for site with and without www., the same content is displayed. Google regularly caches the home page but doesn't even display it for the company name, for which there is nearly no competition. I think G and the other SEs are viewing it as two different sites and that this has tripped a filter.

Is there anything definite I can do to resolve this?

pageoneresults

7:56 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is there anything definite I can do to resolve this?

301 Moved Permanently from the non www to the www version. That is really the only way that I am aware of.

When setting up the 301, make sure to enter the target URI as such...

http://www.example.com[b]/[/b]

With the trailing forward slash. So, any requests for

http://example.com
will now permanently redirect (301) to
http://www.example.com/
.

Once you've got this set up, you'll want to check your server headers to make sure the correct information is being returned. Here's an example of the server header output for a 301...

Server Response: http://example.com
HTTP Status Code: HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/
Server: Server Name
Content-Type: text/html
Content-Length: 153

P.S.

http://example.com
is a sub-domain of
http://www.example.com/
and can be two totally different sites. Most search engines I think realize this and effectively merge the two together. But, when you have incoming links to both non www and www, I believe that is where issues could arise.

brotherhood of LAN

8:03 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The server header checker tools on the net are handy for what P1 results suggests, though for something closer to home I use curl.exe,

curl -I yourdomain.com

from the command line and you'll see the required info.

millie

2:23 pm on Feb 5, 2004 (gmt 0)

10+ Year Member



We have added the following code:

<%
dim domainname, i, s
domainname = request.servervariables("HTTP_HOST")
i = instr(1, lcase(domainname), "www")
if i=0 then
Response.Status = "301 Moved Permanently"
s = "http://www.example.org" & Request.ServerVariables("SCRIPT_NAME") & "?"
s = s & Request.ServerVariables("QUERY_STRING")
Response.addheader "Location", s
Response.End()
end if
%>

This produces the following server headers:

Server Response: [example.com...]
Status: HTTP/1.1 301 Moved Permanently
Server: Microsoft-IIS/5.0
Date: Thu, 05 Feb 2004 11:06:33 GMT
X-Powered-By: ASP.NET
Location: [example.com...]
Content-Length: 0
Content-Type: text/html
Cache-control: private

I am slightly concerned about the Location info. I did it with and without a trailing slash. With / showed it as //index.asp? and without / shows it as /index.asp? but I can't get it to just read [example.com...]

Also, Content-Length: 0
Is this a problem?

Thank you, M

[edited by: pageoneresults at 2:44 pm (utc) on Feb. 5, 2004]
[edit reason] Examplified URIs [/edit]

pageoneresults

2:38 pm on Feb 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Where did you add that code? You should be doing this at the server level through the MMC. If you are doing it on a page, here is what you need to insert above the opening
<html>
tag...

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/"
%>

If you are using ASP.NET, this is the code that would go above the opening

<html>
tag...

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.example.com/");
}
</script>

pageoneresults

2:41 pm on Feb 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Server Response: http*//domain.com/ 
Status: HTTP/1.1 301 Moved Permanently
Server: Microsoft-IIS/5.0
Date: Thu, 05 Feb 2004 11:06:33 GMT
X-Powered-By: ASP.NET
Location: http*//www.domain.com/[b]index.asp?[/b]
Content-Length: 0
Content-Type: text/html
Cache-control: private

Its okay to have the location with the /index.asp. But, you do not want the question mark there. Here is one thing to think about. If you ever change the underlying technology of the site, that URI with the /index.asp is going to get indexed. You'll have to go back and try to update any and all references to that /index.asp if something changes underneath. Tis not a task I would want to be responsible for. ;)

P.S. I checked a few of my 301s and they all return a number in the Content-Length field. Something doesn't seem right with the above.

millie

3:39 pm on Feb 5, 2004 (gmt 0)

10+ Year Member



Does this mean that we should have two sites set up in IIS, one with www and one without. At the moment the sites are set up as domain.com and there is an alias set up in the DNS that allows people to access the domain using the www.

Sorry, M

pageoneresults

4:02 pm on Feb 5, 2004 (gmt 0)

millie

8:30 pm on Feb 6, 2004 (gmt 0)

10+ Year Member



POR, thanks so much for your patience on this.

Can you face having one last look at something?

We had to change the pages site-wide to get rid of the two-sites problem. It's an .asp site with some static pages and some generated on the fly. We've ended up with this as the server header output:

<%
dim domainname, i, s
domainname = request.servervariables("HTTP_HOST")
i = instr(1, lcase(domainname), "www")
if i=0 then
Response.Status = "301 Moved Permanently"
s = "http://www.domain.com" & Request.ServerVariables("SCRIPT_NAME") & "?"
s = s & Request.ServerVariables("QUERY_STRING")
Response.addheader "Location", s
Response.End()
end if
%>

The Location shows with "?" at the end but this is to cope with any possible parameters.

Content-Length is still: 0
We've been working on this all day and can't make it say anything else!

Do you know of anything else we can try? And does the rest of it look OK to you?

V. grateful - Millie

pageoneresults

10:05 pm on Feb 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you review the link I posted above? It looks like you are taking the long route with this when you can easily set this up in IIS. Unfortunately I am not a programmer so I cannot determine what is wrong with your code above. Maybe one of the ASP gurus will drop in and offer some advice.

f00sion

10:19 pm on Feb 6, 2004 (gmt 0)

10+ Year Member



try:

<%
dim domainname, i, s
domainname = request.servervariables("HTTP_HOST")
i = instr(1, lcase(domainname), "www")
if i=0 then
Response.Status = "301 Moved Permanently"
s = "http://www.domain.com"
if request.servervariables("script_name") <> "index.asp" then
s = s & Request.ServerVariables("SCRIPT_NAME")
end if
if len(request.servervariables("query_string") > 1 then
s= s & "?" & Request.ServerVariables("QUERY_STRING")
end if
Response.addheader "Location", s
Response.End()
end if
%>

but i would recommend handling this through mmc so you dont have to add the above code to every single page. Create a new site in your mmc and name it www.yourdomain.com, point the home directory to where all your files are located.. then go to the properties of the site yourdomain.com and instead of setting the home directory set it to redirect all requests to www.yourdomain.com. The only possible downfall to this approach is the status response will be 301 Error.. but it seems to work fine because at least the 301 part is in there.