Controlling the URL generated after an action is performed

Above my listing partial I have a form_remote_tag that encompasses a few
collection_selects for which the :submit => “Filter” action builds the
appropriate :conditions for the database query. This works very well.

Below my listing partial I have my will_paginate page links. This works
very well.

I have been unable to get the two to work together though, because
will_paginate builds a URL of controller?page=… which trips up my
Filter button somehow. In other words, if I’m not on page 1 (no
pagination navigation links have been followed) my filter method is
called properly. If I have used a pagination navigation link, my filter
method (“do_filter”) is listed in the development log this way: (No
route matches “/do_filter” with {:method=>:post})

Conversely, if I have performed a filter, the pagination navigation
links are built thusly, and so won’t work:
http://localhost:3000/controller/do_filter?page=2

I have moved all of this to AJAX with a do_filter.rjs that just does a
page[:listing].reload

What more do I need to do to make sure the URLs getting passed around
are correct? I’m not interested in search engines cacheing these page
URLs as this is an internal project, and there’s no good reason to even
bookmark a specific page or filter condition. I just don’t want the app
blowing up when the user tries to go to page 2 of a filtered collection!

Thanks!!