2

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?

Diodeus - James MacFarlane
  • 107,156
  • 31
  • 147
  • 171
Armstrongest
  • 14,284
  • 13
  • 61
  • 102
  • Can you tell us what the sites you are testing with do say it is returning? – Sam Cogan Jan 20 '09 at 00:23
  • Can I ask why exactly you're doing a redirect? If you 'own' the w/ww/wwww addresses, why not just point them to the same IP address as the www? – paxdiablo Jan 20 '09 at 01:04
  • Pax, that is a bad idea. You should pick one or the other and redirect. http://www.codinghorror.com/blog/archives/001109.html – Samuel Jan 20 '09 at 01:12
  • @Samual, I read your link and I don't think it's appropriate - it talks about your what your *real* DNS name should be (x.com or www.x.com), this question is about catching errors (the real address will still be www). – paxdiablo Jan 20 '09 at 01:19
  • When you say 'point them to the same IP address', it implies a CNAME DNS record, which will make w, ww, and www all act the same which is assumed because otherwise the site he linked woudln't be able to connect. He wants w and ww to redirect to www. – Samuel Jan 20 '09 at 01:24
  • I'm suggesting having four A records (one each for w, ww, www and wwww) all with the same IP address. CNAMES can be used for redirect but I don't think redirect is required here, since the data is to be served from a single IP address. Four A records push the workload out to DNS. – paxdiablo Jan 20 '09 at 03:25
  • I would definately suggest CNAMEs for all the domains he wishes to use so that they will be much easier to change later. But this is not what Atomiton wants, read the question again. He is trying to redirect them using a 301 not serve the same content on 4 subdomains. – Samuel Jan 20 '09 at 03:29
  • I read it but I'm suggesting that he might be asking the wrong question. The "business requirement" is to capture all mis-spellings of the URL and have them work identically to the proper URL. Using 301's is a solution for that requirement, but not necessarily the only (or right) solution. – paxdiablo Jan 20 '09 at 06:00
  • That's why I'm using comments since my "answers" to date don't address the stated needs. I'm thinking the needs should be the business requirement rather than the current implementation. – paxdiablo Jan 20 '09 at 06:02
  • I think he stated his business requirements exactly: have w, ww, wwww, and no subdomain redirect to www.domain.com. This implies that w, ww, www, wwww, and no subdomain all point to the same server and the server will 301 redirect all others to www.domain.com. – Samuel Jan 20 '09 at 06:20
  • I think we'll have to agree to disagree. I believe that "My boss wants..." is the requirement, "I'm trying to redirect..." is his solution. Granted the requirement of *this question* is redirection, I'm just saying questioner may want to re-examine that. Still, I've spent too much time on this one.. – paxdiablo Jan 20 '09 at 07:32
  • @Pax - This is a fairly standard SEO requirement - "All traffic must go to a SINGLE domain (e.g. "www.x.com") - while in Google Webmaster Tools you can specify "Show all results as www.x.com", you are still loosing rankings against other variations of your domain, so it's common to have to redirect – Zhaph - Ben Duguid Jan 20 '09 at 09:03
  • Thanks for all the comments. I was away on holiday and didn't have a chance to check here much. As for why... you're right... it's a "My boss has sent me these websites and I either have to fix it or explain why those websites' reports won't matter. The site that is havine issues is www.pgx.com – Armstrongest Feb 09 '09 at 20:32

6 Answers6

6

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

NotMe
  • 84,830
  • 27
  • 167
  • 241
  • @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 Jan 21 '09 at 02:22
  • My only issue would be: does that generate a proper 301? – Armstrongest Feb 09 '09 at 20:28
  • @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. – NotMe Feb 09 '09 at 22:23
  • 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 May 07 '09 at 18:35
2

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.

QueueHammer
  • 9,487
  • 12
  • 61
  • 89
  • -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 Jan 20 '09 at 01:09
  • "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 Jan 20 '09 at 02:07
  • 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 Jan 20 '09 at 02:37
1

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
  • 35,821
  • 11
  • 83
  • 84
0

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.

Sophie Alpert
  • 126,406
  • 35
  • 212
  • 233
0

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

DavGarcia
  • 17,702
  • 14
  • 52
  • 94
0

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,147
  • 3
  • 12
  • 17