Once it's redirected to index.php, that file can look at $_SERVER['REQUEST_URI']
to determine what is in the this/title/is/cool
portion, and then go look up what page to serve from a database, since the REQUEST_URI lists the full URI string, even though the actual page url that was redirected to is only the first portion of it.
For instance,
http://www.example.com/foo/bar/
gets rewritten to
http://www.example.com/index.php/foo/bar/
This will actually result in http://www.example.com/index.php being loaded, but $_SERVER['REQUEST_URI']
will have the full /index.php/foo/bar/
within it.
Some apps use a different approach, they use .htaccess
to just take the trailing "directories" and put them into the query string, so that the rewrite becomes something like this:
http://www.example.com/index.php?path=/foo/bar/
in which case the supplied path is available in _GET['path']
.