Your own solution is fine, and it works as expected, without touching php code.
However, for my scripts I adopt a different approach:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /processUrl.php [NC, L]
By this way, ALL (Not Foud) incoming requests all redirected to processUrl.php, in which there is a code like this:
$uri = (object) parse_url( $_SERVER['REQUEST_URI'] );
$uri->thread = explode( '/', substr($uri->path, 1) );
if( 'system' == $uri->thread[0] )
{
$_GET['id'] = $uri->thread[1];
$_GET['step'] = $uri->thread[2];
include( 'system.php' );
}
elseif( 'browse' == $uri->thread[0] )
{
// Other condition here
}
elseif( isset( $uri->query ) )
{
// Process ORIGINAL $_GET
}
else
{
include( 'Your404NotFoundPage.php' );
}
I prefer the above method due to:
- Transparency: I can see directly in code how different URI are treated;
- Flexibility: I can add condition or process new url without modify .htaccess file.