rtrim($viewPath, '/') . '/'; // Ensure trailing slash <--- Have you tried rtrim on the /?
Also, do you have a .htaccess file that could be overwriting what your code is trying to accomplish?