I currently have a url like: http://testsite.local/search/?q=findme for my search page once someone makes a query. I use mod_rewrite to rewrite some of the pages and was wondering if it was possible to make this into a nice url like: http://testsite.local/search/1/findme/ (the number 1 being the page of the set of results).



Just a thought: shouldn't it be /findme/1/ instead of /1/findme/?

Written by Evan Mulawski

Haha yes, yes it should. But thats the least of my problems atm.

Written by luke.browning

Accepted Answer

Ok, none of these methods were what I was looking for, after a little research I just decided to redirect to the correct page when a page has a query string. So when a search was made, I just did this:

if ($_GET["posted"] == "true") {
header("Location: /search/" . $_GET["q"] . "/1/");

I know the page has just been posted from a form as it has the hidden "posted" field.

Written by luke.browning
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki