is the last part (i.e. test/1) always the parameters to the php script (i.e. butcher-details(.php) and rate-butcher(.php)) prior to that? there can be 0 (/) or multiple level directories (/cp/..), correct? if so, try something like the following: %