removed getCanonicalUrl function
fixed regex pattern in _rewriteUrls for URL end on /