I want to change URLs like below:
http://www.gsmsite.nl/zakelijk/product/phone?b=met-internet-250plus
To:
http://www.gsmsite.nl/zakelijk/product/phone?bundel=met-internet-250plus
How would I do that with an .htaccess
rewrite rule?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI want to change URLs like below:
http://www.gsmsite.nl/zakelijk/product/phone?b=met-internet-250plus
To:
http://www.gsmsite.nl/zakelijk/product/phone?bundel=met-internet-250plus
How would I do that with an .htaccess
rewrite rule?
You would need to use a RewriteCond
against the QUERY_STRING
variable.
RewriteCond %{QUERY_STRING} ^b=(.*)$ [NC]
RewriteRule ^/zakelijk/product/phone$ /zakelijk/product/phone?bundel=%1 [NC,L,R=301]
It might be wiser to do any business-logic redirects in PHP; rather than, complicating HTTPD behavior.
if (isset($_GET['b'])) {
location($_SERVER['PHP_SELF'].'?bundel='.$_GET['b']);
exit;
}