Fix bug in config creation that caused some invalid URLs

When replacing '//' with '/' in URLs, we should not replace the '//' in
a protocol specification (like 'http://'). This has been fixed with a
protocol whitelist. Thanks to Wei for pointing this problem out.