I have a search engine script that formats it's URLs from a .htaccess file. However, when a search is made on the site, the search URL has /search/QUERY%20TERMS/1/. (Notice the %20 in between each word). Is there any way with PHP or .htaccess that I can have + instead of %20?
My .htaccess code is currently this. It formats the SERP URLs.
RewriteEngine on
RewriteRule ^search/([^/]+)/([^/]+)/?$ search.php?q=$1&category=web&d=$2
RewriteRule ^search/([^/]+)/$ /search/$1/1/ [R=301,L]
RewriteRule ^search/([^/]+)$ /search/$1/1/ [R=301,L]
RewriteRule ^search/?$ / [R=301,L]
And my PHP code is currently this. It allows the search box to go to the correct SERP as it has a complicated URL structure.
<?PHP
if( isset( $_POST['q'] ) )
{
header( 'location: search/' . $_POST['q'] . '/1/' );
exit();
}
?>
How can I get my URLs to have + instead of %20 in PHP or .htaccess?
Any help is much appreciated, thanks in advance. Callum