I am trying to rewrite an url with mod_rewrite.
Problem is the url to be rewritten contans a literal + (plus) sign, and that’s also the delimiter for the vars I need to get from the url…
Current url’s:
http://www.domain.com/page/756/no/Plumbers+London/
I want the part “Plumbers+London” to be taken and rewritten as:
New url’s:
domain.com/pages/Plumbers/London/
Tried this but it doesn’t work:
RewriteRule page/(.)/no/(.)\+(.*)/ /pages/$2/$3/ [R=301,L]
Any help would be highly appreciated!
Thanks in advance!
I would change the delimiter.
Ah simple mistake.
The dot (.) matches the full URI by itself, or it matches any single character.
Try changing it to:
(My regex is a bit rusty, but I believe that will do the trick.)
Perhaps use a non-greedy operator: (.*?)