Smarter relative URL replacing system