Reputation: 15778
Here's what I'd like to do:
/gestion/aa/ => /gestion/aa.php
/gestion/bb/ => /gestion/bb.php
/gestion/a/b/ => /gestion/a/b.php
/gestion/a/b/c/ => /gestion/a/b/c.php
/cmd/aa/ => /cmd/aa.php
/cmd/bb/ => /cmd/bb.php
/cmd/a/b/ => /cmd/a/b.php
/cmd/a/b/c/ => /cmd/a/b/c.php
/json/aa/ => /json/aa.php
/json/bb/ => /json/bb.php
/json/a/b/ => /json/a/b.php
/json/a/b/c/ => /json/a/b/c.php
This brought me to this simple regular expression:
^/(gestion|cmd|json)/(([^/]+/)*)$ /$1/$2.php [QSA,L]
The problem is that $2
has always the /
within so the results are:
/json/aa/ => /json/aa/.php
/json/bb/ => /json/bb/.php
/json/a/b/ => /json/a/b/.php
/json/a/b/c/ => /json/a/b/c/.php
Any idea how to get the right regexp?
Upvotes: 0
Views: 49