Support Forums

Netlify subdirectory functions issues

Hi, im preparing multiple landing pages on my repo “links”, with subdirectories exmple “post-1, post-2…”, every subdirectory (landing page) has a directory public with index.html and functions with the .js file, when im trying to run the js file code using full path of the netlify site it doesn’t work the full path im copying is: https://yournetlify.netlify.app/linkes/post-1/.netlify/functions/redirect.
errors are shown on the pictures also, I don’t understand whats the problem i’ve been searching but hardly to understand.

hi there @lamre, welcome.

I am having a little trouble understanding. Can you explain in a different way what you are trying to accomplish, and give us as many details as possible? I want to be sure i get what problem you are trying to solve so we can best advise you. thanks. :slight_smile:

1 Like

Hi @perry on my main repository Im creating multiple directory folders for multiple landing pages like example /main/post-1/index.html, on every landing page folder im creating a function folder /main/functions/file.js so when im copying full path of js file to run on browser it doesn’t work it says page not found im copying and pasting on browser like this https://yoursite.netlify.app/post-1/.netlify/functions/file, and it doesn’t work I don’t know if my functions are not being deployed or here is anything else wrong.

Simply put, this is not expected to work.

All functions need to be in a single folder - you can’t distribute them the way you’ve done it, Netlify won’t scan your entire repo for files that “could look like a function” as we don’t know which JS file is supposed to be a function and which one is not.

Could you explain your use case better as to why you’re trying to do it this way and what is the result you want to see? We could advise about the best path accordingly.

@hrishikesh thanks you for your reply, I have figured out all this on diff way, I don’t really need any help now.