Using getBasePath() instead of getBaseUrl() to detect basePath.