# Googlebot crawls parameter to Ajax.Autocompleter

**URL:** <https://www.ruby-forum.com/t/googlebot-crawls-parameter-to-ajax-autocompleter/143070>\
**Category:** Rails\
**Created:** [July 14, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/googlebot-crawls-parameter-to-ajax-autocompleter/143070 "2008-07-14T23:01:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [July 14, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/googlebot-crawls-parameter-to-ajax-autocompleter/143070/1 "2008-07-14T23:01:05Z")

</div>

I’m using the autocomplete plugin for Rails, and have this code in all  
pages (within tags):

var product\_title\_auto\_completer = new  
Ajax.Autocompleter(‘product\_title’, ‘product\_title\_auto\_complete’,  
‘/store/auto\_complete\_for\_product\_title’, {})

This line is generating errors with Googlebots. Apparently trying  
Googlebot is trying to crawl the url:  
‘/store/auto\_complete\_for\_product\_title’ which is defined only in this  
ajax call.

I’m assuming Googlebot is parsing the text and seeing the url  
(parameter) as a link to try, and results in a 500 error. Any ideas  
how I can refactor this out of this context so Googlebot won’t see it?

–  
Anthony E.  
408-656-2473  
[http://anthony.ettinger.name](http://anthony.ettinger.name)

---

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [July 15, 2008, 1:30am UTC](https://www.ruby-forum.com/t/googlebot-crawls-parameter-to-ajax-autocompleter/143070/2 "2008-07-15T01:30:16Z")

</div>

My approach would be to first ensure the action does not throw an  
error when visited directly (non-ajax) by any browser or bot.

In your ajax-only action:  
redirect\_to :controller =\> ‘some\_controller’, :action =\> ‘some\_action’  
unless request.xhr?

or possibly (?)

respond\_to do |wants|  
wants.html { redirect\_to(…etc…) }  
wants.js  
end

You could then use robots.txt to encourage bots not to crawl that  
link.
