0

I have a search engine on my site with two search parameters, location and query. I want to show the results on a page with the canonical URL of /search/location/query.

I tried aiming the search at a non-existant PHP file which I could then rewrite using my .htaccess:

# search bar rewrites
RewriteRule ^search.php?query=([A-Za-z_-]+)&location=([A-Za-z_-]+)$ /search/$1/$2/ [R]

This doesn't seem to be working, however, and after setting my search form to post GET to search.php I just get a 404. I would prefer not to have to use Javascript to submit the form directly to the canonical url - any way I can rewrite it dynamically with mod rewrite?

MarathonStudios
  • 3,983
  • 10
  • 40
  • 46

1 Answers1

0

Wouldn't the better approach be to change the form from a get to post?

Generally pretty URIs are for actual locations rather than search results.

Shad
  • 15,134
  • 2
  • 22
  • 34
  • My search is different from a general open ended search, as there is a fairly limited set of values people would search for - enough to justify making it look more like a "location" instead of search results, but not few enough to justify not having the search box. – MarathonStudios Mar 02 '11 at 06:36