I found out why this wasn't working for me, and, in the site settings, under sftp settings, the 'Web URL' was incorrect - I probably changed it accidentally when I was editing the 'Root Directory' because the website itself wasn't stored in the root directory of the sftp server. Fixing the "Web URL" corrected this problem for me.