Modified URI function to accept urls without a trailing slash