The obvious one is that the message you generate is not an URL. It reads something like: stackoverflow/questions/40062450/.... An URL starts with a protocol (usually http://). The text you send should be:

http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}

An URL (as the one generated by the above code) contains special characters that must be encoded when it is used as an argument in another URL (f.e. &). Failing to properly encode & when you want to use it as a parameter in an URL leads to the generation of a different URL than you think. Smarty provides the escape variable modifier for this purpose.

You generate HTML and, because some characters are also special in HTML you have to properly encode them, otherwise the HTML you generate could be invalid and the browser could think the URL ends earlier than you intend. The escape modifier helps you here too.

Putting all together, the best way is to build the URL into a separate Smarty variable then write it into the href attribute: