I just implemented a search function in my program. If a search string is sent, the program doses this:
if (isset($_GET['s'])) {
header('Location: /search/'.rawurlencode($_GET['s']));
exit;
}
The only problem I ran into is that the resulting URL of the search string is not actually human readable, for example. search term is 500€ a lot of moneyis displayed in is%20500€%20a%20lot%20of%20money. I would like to create a more user friendly search URL, for example. is+500€+a+lot+of+money.
Is there an easy way to do this or do you need to encode the string manually, for example. look for spaces, etc. and replace them.
source
share