Formatting
Moved URL generation into its own method
$boostrap => $bootstrap
More carefully strip '/index' from the URL
If a page with '/index' is requested, then strip it from the URL and redirect
Removed unnecessary rewrite rule that caused 404s

If you'd request a URL like 'http://localhost/tmp/Phile/sub/index', it would redirect to 'http://localhost/sub' instead of to 'http://localhost/tmp/Phile/sub'
Fixed failing unit test