This page appears to have a solution to what you are trying to do:
<?
$Params = explode( '/', $PATH_INFO );
while( list( $Index, $Value ) = each( $Params )) {
echo "Params[ $Index ] = $Value<BR>
" );
}
?>
Hit this URL:
http://whatever.site.com/ThisIsAProgram/these/directories/are/not/real
You should get:
Params[ 0 ] =
Params[ 1 ] = these
Params[ 2 ] = directories
Params[ 3 ] = are
Params[ 4 ] = not
Params[ 5 ] = real
And to display the PHP file as just the file name, try this:
Options +MultiViews
RewriteEngine On
RewriteCond %{THE_REQUEST} /([^.]+).php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]
EDIT: If you are wanting a more complete example, this answer covers it a lot more in depth than I could. This will definitely help you cover all your bases and understand the issue if my other linked article doesn't make it clear enough.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…