views:

34

answers:

1

Currently I have the following rules...

RewriteRule ^([^/]+)/([^/]*)(.htm)?$ index.php?filter=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/$ index.php?filter=$1 [L,QSA]

Which basically catch anything in /dirname/page.htm

Now there exists the chance that the script will have to intercept a variable level of paths, such as /dirname/twodirname/threedirname/page.htm

Is there a way of doing this and handling the result in PHP with one rule rather than a mess of them in htaccess (and the multiple _GET variables generated)?

+1  A: 

You can handle the URL in PHP no problem. I had the same question a few weeks ago, check out the accepted answer.

Don't let the rule be too general, though. Any kind of static resources should still be accessed directly, passing them through PHP is expensive.

Pekka
That works, thx.
Meep3D