Forum

Thread tagged as: Question, Runway

Search page URL

I've got search setup on my site and when I submit a search term it takes me to the Search page I've set up with a URL that looks a bit like https://example.com/search?q=search-term-here. I've got Runway returning search results at https://example.com/search/search-term-here which is nice and tidy but I'm not sure how I amend the URL that you end up on when you search. I only get the tidy URL when I hack the URL in the browser.

There's nothing I can spot in Perch's perch/templates/ directory that contains ?q= so I'm not sure this is something I can edit outside of core, but hopefully I'm wrong :)

I suppose I could do a redirect from one page to the other in my Nginx config (or .htaccess for Apache sites) but this feels a bit heavy.

Martin Underhill

Martin Underhill 5 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The q is the name of the field in your search form template, so you can change it there.

I'd argue this is absolutely where you should be using a query string, but if you wanted to get rid of it you'd need to submit your form to an intermediary script to rearrange the URL and issue a redirect.

Thanks Drew. I think I'll leave it – I've done a bit of digging and you're right about it being the right place for a query string :)