More work on double slashes prevention

Rework // prevention in base urls

We now:
1. process substitutions;
2. add a '/' at end of urls if missing.

This way we should avoid creating '//' situations.