fixes #4520 Vanity URLs redirect to a directory name fail