Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
709 views
in Technique[技术] by (71.8m points)

jquery - 404 errors on /a folders in Webmaster Tools

In Google Webmaster Tools, under crawling errors, my number one 404 error is something called

www.domain.com/a 

There is no such thing in my site and there is no link to it. What is wrong, what does it mean? In the site log, there is no error about 404 error pointing to /a. W3C checker says no error. What can I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's not you, it has to be the Googlebot. (none of this has to do with php; perhaps somebody can remove the php tag.)

I have eight sites in my Google Webmaster Tools and two totally unrelated sites are showing this same thing. Neither site showing this issue uses PHP.

The only thing I can think of is that Google's bot is incorrectly parsing the HTML and somehow appending closing "a" tags onto the root URL. Sounds stupid but it's the only thing that can explain multiple unrelated instances of this problem.

Has anyone started a thread on this in the Google Forum yet?

I'm not sure what effect this will have on the root problem but I put this in my htaccess file to hopefully clear out the false 404 errors. (Edit: this is the recommended solution by Google.)

Redirect 301   /a   http://www.mysite.com

EDIT:

Reported to Google Help Forum:

http://www.google.com/support/forum


EDIT 2:

Both sites validate at the W3C and neither use PHP.


EDIT 3:

The "/a" is coming from inside jQuery v1.5.2. This is the root cause.

Within jQuery itself is this line...

<a href='/a' style='color:red;float:left;opacity:.55;'>a</a>

EDIT 4:

Block it with the robots.txt file. (According to Google, this will only change the Webmaster Tools Crawl Error from a "404" to a "Blocked by robots.txt")

Disallow:  /a/
Disallow:  /a

EDIT 5:

The following is a response from Google employee JohnMu on this issue in the thread I started at Google Groups. Looks like I'm going to stick with the 301 after all.

JohnMu

Google Employee

4:39 AM

Hi guys

Just a short note on this -- yes, we are picking up the "/a" link for many sites from jQuery JavaScript. However, that generally isn't a problem, if we see "/a" as being a 404, then that's fine for us. As with other 404-URLs, we'll list it as a crawl error in Webmaster Tools, but again, that's not going to be a problem for crawling, indexing, or ranking. If you want to make sure that it doesn't trigger a crawl error in Webmaster Tools, then I would recommend just 301 redirecting that URL to your homepage (disallowing the URL will also bring it up as a crawl error - it will be listed as a URL disallowed by robots.txt).

I would also recommend not explicitly disallowing crawling of the jQuery file. While we generally wouldn't index it on its own, we may need to access it to generate good Instant Previews for your site.

So to sum it up: If you're seeing "/a" in the crawl errors in Webmaster Tools, you can just leave it like that, it won't cause any problems. If you want to have it removed there, you can do a 301 redirect to your homepage.

Cheers

John


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...