handle hierarchical urls with trailing slashes