I checked an album page on metal archives. It seems in the link spaces are replaced with underscores. If an artist has spaces change %artist% to $replace(%artist%,$char(32),_). You'll probably will need to do the same for %album% so change that too to $replace(%artist%,$char(32),_).
You're actually doing something similar that I use only I do it for rateyourmusic.com. This for example gets the artist page:
https://rateyourmusic.com/artist/$lower($replace(%artist%,!,_,.,_,$char(32),_,&,and,é,e,à,a,è,e,á,a,$char(40),_,$char(41),_,-,_))
the $replace function replaces a certain character within a tag value with the next character described in the function.
Looking at this
$replace(%artist%,$char(32),_).
$char(32) is the ascii code for the space character which gets replaced with _.
Note in my example I have way more characters to replace because weblinks don't use said characters (& becomes and, é becomes e,à becomes a,.....). Chances are you will need to do the same for metalarchives to get all exceptions right. You can adapt my rateyourmusic link and see if that catches all exceptions.