Fix some errors, use php native parse_url for parsing URL. And fix the router.php to remove trailing slash