Successive URL rewriting with only one rule

61 Views Asked by At

I would like to create a unique rule to rewrite my URLs
It would increment the variable number for every "/" encountered.

e.g.

domain.com/alpha/bravo/charlie/ -> index.php?1=alpha&2=bravo&3=charlie  
domain.com/alpha/bravo/charlie -> index.php?1=alpha&2=bravo&3=charlie
domain.com/alpha/ -> index.php?1=alpha 
domain.com/alpha -> index.php?1=alpha  
Or eventually
domain.com/alpha/ -> index.php?1=alpha&2=&3=

Thanks for your help

1

There are 1 best solutions below

0
On

Why not just use a general rewrite like most open source software use and then manipulate it within PHP? See this thread