Apache actually works this way by default. There's no need to mess with mod_rewrite. Here's a simple test:
http://greybox.justinhileman.info/test.phps Check out: http://greybox.justinhileman.info/test.php REQUEST_URI: /test.php SCRIPT_NAME: /test.php PATH_INFO: Versus: http://greybox.justinhileman.info/test.php/foo/bar REQUEST_URI: /test.php/foo/bar SCRIPT_NAME: /test.php PATH_INFO: /foo/bar Several newer PHP frameworks (Symfony2, Silex, and friends) use this style of URL for their default fallback "clean URLs" if you don't have mod_rewrite configured. --justin On Fri, May 17, 2013 at 4:31 AM, Dan Egli <ddavide...@gmail.com> wrote: > Hey folks, something I've been wondering. I'm sure we're all used to seeing > URLS that end in things like /file.php?req=12 or similiar. That's easy. But > lately I've seen an increasing number of pages that seem to put the php > page as a directory and the request as a separate file. A good example was > the ATA wiki page on kernel.org. That read > ata.wiki.kernel.org/index.php/ATA_Secure_Erase. > > > > I could easily make a page that would pull up content by something like > index.php?section=ATA_Secure_Erase, but how on earth do you setup Apache to > recognise in this URL that index.php is not a directory and > ATA_Secure_Erase not a separate file? Or is that exactly what happened and > they are simply calling the directory index.php for whatever reason? This > is something that's been bugging me for a while. The way I understand > things, you'd need to configure Apache to send the index.php page, and then > you need to have some kind of IF check to see if ATA_Secure_Erase was set. > But at the same time, I'd wonder WHAT variable to check. Would it be > something like $_GET["ATA_Secure_Erase"]? Or would it be > $_GET["<something>"] == "ATA_Secure_Erase" or similiar? > > > > Thanks for the tips on this. Like I said, it's been bugging me for a while. > > > --- Dan > > /* > PLUG: http://plug.org, #utah on irc.freenode.net > Unsubscribe: http://plug.org/mailman/options/plug > Don't fear the penguin. > */ > -- http://justinhileman.com /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */