On 8/5/07, Elliotte Harold <[EMAIL PROTECTED]> wrote: > > Surely by now there's a better way? How do I overcome the one file per > URL assumption that PHP makes?
I've tried at least four different ways around this over the years, and I use mod_rewrite for everything but trivial apps. Here are the ways I'm aware of: 1) Use ErrorDocument directive to pass 404s to a php script http://httpd.apache.org/docs/2.0/mod/core.html#errordocument 2) Use Action and AddHandler directives http://httpd.apache.org/docs/2.0/mod/mod_actions.html#action 3) Use Multiviews option so that /index.php/path/to/some/virtual/resource resolves to index.php http://httpd.apache.org/docs/2.0/content-negotiation.html#multiviews 4) Use mod_rewrite to send all requests to the same script The only one I _wouldn't ever_ try again is the ErrorDocument method, because the $_SERVER environment that you end up with (and which is crucial to determining what was actually requested) is not what you'd expect. Mutliviews is always tricky for me, for some reason. I have a hard time getting it to work with my base server config. Also, I don't like to have the script name in every request. Rewrite has proven to be the most flexible and (long-term) easiest solution for me. But the Action/Handler method doesn't require any extra extensions. I see it used by other projects, notably Trac. -- Chris Snyder http://chxo.com/ _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php