fix: properly handle trailingSlash: true
and rewrites
#43641
Merged
trailingSlash: true
and rewrites
#43641