: How to redirect a URL without a query string to a URL with a query string? I've looked around for the answer to my question but only to be confused even more. I'm hoping somebody can help
I've looked around for the answer to my question but only to be confused even more. I'm hoping somebody can help me...
I need to redirect this URL:
www.example.co.uk/ecommerce/cabinets/aluminium_cabinets
To:
www.example.co.uk/products/cabinets/?types[]=illuminated-aluminium-cabinets&types[]=non-illuminated-aluminium-cabinets
I'm using mod rewrite in .htaccess
More posts by @Jennifer507
1 Comments
Sorted by latest first Latest Oldest Best
No particular trickery is required. Using mod_rewrite in .htaccess:
RewriteEngine On
RewriteRule ^ecommerce/cabinets/aluminium_cabinets$ /products/cabinets/?types[]=illuminated-aluminium-cabinets&types[]=non-illuminated-aluminium-cabinets [R,L]
Apache will escape (percent encode) the square brackets ([ and ]) by default, which are not strictly allowed unencoded in this context in the URL. (This won't affect reading the URL parameters using PHP's $_GET array.)
This is a temporary (302) redirect. To make it permanent, change R to R=301. Alternatively, to make it an internal rewrite, simply remove the R flag.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.