views:

435

answers:

2
+4  A: 

You could use a PHP function to do that. Quickly, with no default value or error handling:

list( $controller, $function, $params ) = explode( '/', $uri, 3 );
$params = explode( '/', $uri );

And in the .htaccess, redirect any non-existing query to your PHP query-handling file:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ mvc.php [L,NS]

Beware to filter your input though, not to include any file, etc.

streetpc
+1  A: 

You could also have your htaccess like this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*) mvc.php?model=$1&view=$2&parameters=$3 [L,NS]

This is just another way to do it, although personally I prefer streetpc's way.

rogeriopvl
Hey, thank you for getting back to me so quickly. I edited my question to include my tested code that I modified from what you supplied me. Almost there, just needs some tweaking. Thank you.
Torez