I'm fairly new to mod_rewrite and I'm trying to get the RewriteMap directive to work properly. I would appreciate your help in using it.
Our URL format is as follows:
example.com/section.php?xSec=[ID]
So for section 201, which is 'Apple iPads' the URL is:
example.com/section.php?xSec=201
What I'm wanting is to rewrite this to:
example.com/apple-ipads
I have defined the RewriteMap txt file in apache config, using the following line:
RewriteMap sections txt:/var/www/rewrites/sections.txt
This txt file contains the following:
multifunction-printers 102
inkjet-printers 103
laser-printers 104
apple-ipads 201
I have attempted the following rewrite rule in .htaccess:
RewriteRule ^/section.php?xSec=(.*) ${sections:$1}
Which doesn't work. I'm assuming that there is either an issue with my RewriteRule or I've put the RewriteMap directive in the wrong place in the config file. Any suggestions?
Thanks in Advance
Daniel