Posted 2004-09-04T15:39:00+01:00 in php apache

PHP Stub without the .php filename

Many people like to have a REST-like path to their PHP script. Instead of the copious mod_rewrite examples, here's a light-weight example that you can use in your .htaccess files and doesn't require mod_rewrite:

<Files "mystub">
    SetHandler application/x-httpd-php
</Files> 

Or, for old-skool Apache 1.3:

<Files mystub>
    ForceType application/x-httpd-php
</Files> 

Now you can run php code from a file named 'mystub', e.g.: http://localhost/mystub/template/user/object.html