performs trailing slash redirect in PHP code