Board Thread:Support Requests - Getting Technical/@comment-27468767-20200709025034/@comment-168424-20200710172225

The only thing I can guess is that when you manually enter a name it URL encodes it behind the scenes for some reason, but not when it pulls it from the magic word &#123;&#123;PAGENAME&#125;&#125;... you may be able just to switch to &#123;&#123;PAGENAMEE&#125;&#125; which returns a URL encoded version of the pagename rather than encoding it yourself.

As for #vardefine, it is part of a non-default extension called Variables, so you shouldn't expect it to be on most wikis.