Keep cached urls with different hostnames or baseurls seperate

For #7981, prevents cached urls that were generated for one host/webroot being used when accessed trough another host/webroot.

cc @DeepDiver1975 @PVince81