Command-line URL
As a followup to Chris' article about getting query-param behavior in a URL without query params, this is a fairly simple way to make the URL look more regular by eliminating the .php extension in the middle. Edit your Apache conf file something like this:
<Directory /var/www/test> # everything in /test is now executed as a PHP script ForceType application/x-httpd-php </Directory>
Now put a file like the sample one that Chris made in your doc root:
/var/www/test/foo
Note that the file is called foo, without an extension! Now you should be able to go to http://www.example.com/test/foo/bar/baz, and PHP PATH_INFO will be /bar/baz.
Some disadvantages of this approach are that it requires an Apache config change for every new script directory, and you still need a parent directory in the URI, unless you want your _whole_ server to serve only PHP files. So if you wanted to do this:
http://www.example.com/users/mike
http://www.example.com/users/chris
Then you'd have to config your root directory with ForceType, or you'd have to settle for something like this:
http://www.example.com/get/users/mike
http://www.example.com/get/users/chris
