Thanks @Podders, the honest truth is, and I’m embarrassed to admit, that I hadn’t properly configured my Mamp development environment correctly for subdomains, so when using root-relative URLs, on a domain such as http://localhost/mysite, the links would always take me back to the localhost root instead of the intended site root.
I decided to get my hands dirty this morning, and get into setting up virtual hosts on Mamp and I’ve got everything up and running, so http://localhost/mysite is now http://mysite.localhost, and the root relative URLs are working perfectly.
I should’ve done this weeks ago, it would’ve saved loads of hours, but I have learned a lot along the way.
Anyways, thanks again for the nudge! (And for your code)