Hi,
A.t.m. I’m struggling with mod_rewrite, i don’t think the solution will be hard but i just can’t get it right. Here’s my question:
I want to 301 redirect all URL’s containing "abc/nl/" to "/nl/" and i want to append the rest of the URL afer "nl/", to the new URL.
So
http://www.test.nl/abc/nl/widgets?a=9&b=100 should become
http://www.test.nl/nl/widgets?a=9&b=100 .
For this I constructed the following RegEx:
RewriteRule abc/nl/(.*)\?(.*) /nl/$1?$2 [R=301,L]
I tested the regex with this regex tester,
http://www.quanetic.com/regex.php
Fill in as regex -> abc/nl/(.*)\\?(.*) --(i used \\ in this example because the test script strips slashes, \\ should of course be \ in reality)
Fill in as haystack->
http://www.test.nl/abc/nl/widgets?a=9&b=100
There should be a positive match with 2 groupings "widgets" and "a=9&b=100"
The problem is that Modrewrite does not execute this rule: RewriteRule abc/nl/(.*)\?(.*) /nl/$1?$2 [R=301,L]
I think it can’t match it on the URL(same URL as used in example).
I don’t understand what is wrong with this rule, as it checks out fine in the RegEx tester.
Can anybody say what I’m doing wrong?
Thanks for your time if you are reading this.