redirecting w., ww., wwww. to -> www

2019-05-19 05:31发布

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?

6条回答
Ridiculous、
2楼-- · 2019-05-19 05:56

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.

查看更多
我命由我不由天
3楼-- · 2019-05-19 05:56

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.

查看更多
SAY GOODBYE
4楼-- · 2019-05-19 06:06

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.

查看更多
太酷不给撩
5楼-- · 2019-05-19 06:07

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.

查看更多
手持菜刀,她持情操
6楼-- · 2019-05-19 06:12

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

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2019-05-19 06:16

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

查看更多
登录 后发表回答