Cloaking URLs - Where should I place the out folder?

Hey, I’m trying to cloak URLs using a script because it’s kind of difficult to nofollow URLs with the editor.

I’m using this technique How to cloak your affiliate links • Yoast

I’ve already modified my robots.txt to disallow /out/, but I can’t figure out where to put the /out/ folder.

I’ve placed it here /opt/bitnami/apps/ghost/htdocs/out (I’m using bitnami)

But it didn’t seem to work. Does anyone know the proper location I should create the /out/ folder?

Edit: Maybe I can do this with redirects.json

So I was able to create external redirects with the redirects.json

[{
  "from": "/out/example" ,
  "to":  "https://example.com",
  "permanent": true
}]

Now I just need to figure out how to automatically nofollow /out/ links. Any suggestions?