views:

1006

answers:

6

I'm trying to redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com.

My boss wants to ensure typos make it to the site as well.

They redirect fine. I'm using ASP.Net and throw a 301 redirect back using a regular expression, however, tools such as http://www.seoconsultants.com/tools/headers.asp don't seem to show a correct redirect when I try to use w.site.com ww. etc.

I'm trying to figure out what google sees, but I'm not sure where to check.

It would "appear" that firebug reports it as a 301, but I can't figure out why these tools are reporting back the wrong information. My boss is using web tools to see if these work, so does anyone know a way to prove that a 301 is being sent back correctly. Or can anyone recommend a way I can check for myself if a proper 301 is being returned?

A: 

If you have access to a Unix-type box, you can type this to see the returned headers:

curl -I ww.site.com

But I'd trust Firebug if I were you.

Ben Alpert
A: 

Might try using IIS instead just to see if that quells the SEO tools.

DavGarcia
+2  A: 

If you have access to your domain registrar you can change the CNAME record to point to the correct domain. This is the same thing as setting up a sub domain using DNS but in this case wwww or w both point to www on your website. From a design point of view you are also offloading the work of the redirect to another server.

JustSmith
-1, this won't solve his problem. CNAME does not do this for you. CNAME records say that the hostname has the same IP as the content hostname's IP. They do not perform redirection from one domain to another, you must do this yourself at the server level not the DNS level.
Samuel
"redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com." this answer sounds correct to me.. where are you getting the "multiple domains"? It's not in the question.
Jeff Atwood
A CNAME record of ww which has the content value of www.domain.com will not redirect HTTP(S) traffic from ww.domain.com to www.domain.com. It will only cause the DNS client to do one additional lookup to find to the IP. ww will now act exactly as www and will not redirect.
Samuel
A: 

Use Fiddler to directly view the headers being sent back from the web server (and much much more - Fiddler is a tool that every web developer should have on hand, and it's free).

Google Webmaster Tools will report on 404's and other errors that Google hits while crawling your site. You can also set your preferred canonical domain name format (www.site.com vs. site.com).

Google is only going to "see" one of your redirects from a malformed URL (e.g. from w.site.com to www.site.com) if a malformed link actually exists somewhere that Google would attempt to crawl. I suppose you could put some test links somewhere unobtrusive on your site, check Google Webmaster Tools to see what Google does when it crawls those test links, and then delete the test links when you're satisfied with the results. Google's crawls are non-deterministic, so you might have to wait weeks before Google crawls those test links.

Lee Harold
+1  A: 

Try using the Live HTTP Headers plugin for Firefox to examine the headers the server sends back to you. If Live HTTP Headers reports a 301 redirect, try capturing the user agent on the server side and change your Firefox to use that user agent. If you still get a 301 redirect, you will have to examine the server more closely to see if the request from SEO Consultants is reaching the code around the redirect.

You can also try using IIS and adding a bunch of redirection websites that respond to the w, ww, and wwww subdomains instead of using global.asax and redirection there.

Samuel
+4  A: 

Add a * A record to your dns entry. Yes that is an asterisk. This will cause anything that is not explicitly defined to go to that IP.

For example: *.site.com

Chris Lively
@Atomiton: You should consider this the correct answer, because this is the ideal one, normally you have access to add an A NAME, just add *.yourdomain.com and point it to the same IP address that www.yourdomain.com points, give it a ttl (Time To Live) of 43200.
balexandre
My only issue would be: does that generate a proper 301?
Atømix
@Atomiton:This in itself doesn't generate a 301. Instead it forwards all the requests to your web server. From there you can set up a website that responds to all the URLs not already explicitly handled and do a redirect to the real website.
Chris Lively
This is great from the standpoint of getting the user to the right place, but this is not the solution from an SEO standpoint.
Aaron