What you want to achieve is called the "Front Controller" pattern. It's usually done with the use of Apache's mod_rewrite. Without URL rewriting you can still do something similar, but your URLs would look like this:
mysite.com/index.php/controller/view
Instead of:
mysite.com/controller/view
as you want.
Here's a minimal .htaccess file to do the URL rewriting:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
Then you parse the URL from $_SERVER['REQUEST_URI'] but remember to strip off any GET parameters at the end when determining the view name.
I personally wanted something like this recently without a full-fledged framework so I used this micro-framework just to do the routing, and it worked very nicely:
http://www.slimframework.com/
Then you can write your own controller class and set up the routing; here's the code I used:
$app = new \Slim\Slim();
$app->map('/:controller(/:action)', 'dispatchControllerAction')
->via('GET', 'POST');
function dispatchControllerAction($controllerName, $action='index') {
//multi-word controllers and actions should be hyphen-separated in the URL
$controllerClass = 'Controllers\\'.ucfirst(camelize($controllerName, '-'));
$controller = new $controllerClass;
$controller->execute(camelize($action, '-'));
}
/**
* Adapted from the Kohana_Inflector::camelize function (from the Kohana framework)
* Added the $altSeparator parameter
*
* Makes a phrase camel case. Spaces and underscores will be removed.
*
* $str = Inflector::camelize('mother cat'); // "motherCat"
* $str = Inflector::camelize('kittens in bed'); // "kittensInBed"
*
* @param string $str phrase to camelize
* @param string $altSeparator Alternate separator to be parsed in addition to spaces. Defaults to an underscore.
* If your string is hyphen-separated (rather than space- or underscore-separated), set this to a hyphen
* @return string
*/
function camelize($str, $altSeparator='_')
{
$str = 'x'.strtolower(trim($str));
$str = ucwords(preg_replace('/[\s'.$altSeparator.']+/', ' ', $str));
return substr(str_replace(' ', '', $str), 1);
}