Keeping api/ untouched while updating content pages: separating code from copy
My site, ramrom.io, is a plain PHP downloader running on shared hosting. There is no framework, no build step, and no database. The whole project is a folder of HTML pages, a couple of stylesheets, some JavaScript, and one small folder called api/. That folder holds the code that actually does the work: resolve.php talks to the video providers, the proxy streams the file back, and config.php holds the API keys.
Early on I made a rule for myself: when I am updating content pages, I do not touch api/. Not because the code is sacred, but because the two kinds of work carry very different risks, and mixing them in one upload is how a small copy edit takes the whole tool down.
Why the split matters
A content change is low risk. I rewrite a paragraph on a guide page, add a card to the homepage, or fix a typo in a FAQ. If I get something wrong, one page looks odd. An API change is high risk. If I break resolve.php, every tool page on the site stops working at once, because they all call the same endpoint. The blast radius is the whole site, not one page.
So the rule is simple: content uploads and code uploads are separate jobs, done at separate times, and I only ever upload the files that changed. When I added three guide pages recently, the zip I uploaded contained three HTML files and nothing else. api/ was never in the zip.
How the layout enforces it
The layout does most of the work for me. Content pages live in the site root as plain HTML files: the homepage, the tool pages, the guides, the blog. The working code lives under api/, and nothing else in the project needs to go near it. A page that needs the downloader calls /api/resolve.php with a fetch request and never includes the file directly, so no PHP include chain ties a content page to the API code.
The config is protected twice over. config.php sits inside api/, and a .htaccess rule in that folder blocks direct web access to it. Even if someone guesses the filename, the server refuses to serve it. The keys never leave the server, and they never appear in a page, a script, or a zip.
I also keep api/ out of the sitemap. Search engines have no reason to crawl an endpoint, and listing it would only invite curious requests. The sitemap lists the pages a visitor should find. The API is plumbing, and plumbing does not belong in the index.
What this looks like on upload day
My deploy process is deliberately boring. I zip only the files that changed, upload the zip through the host's file manager, extract it, and check the live page in a browser. Because the API folder is never in the zip, I never have to wonder whether an upload overwrote a working endpoint with a stale copy. I have done that before in other projects, uploading a whole folder "just to be safe" and replacing a live file with an older version from my laptop. On shared hosting with no version control on the server, that mistake is a quiet one: the site still loads, but downloads fail, and you find out from a visitor, not from an error log.
The trade-off, honestly
Separating code from copy is not free. A change that genuinely needs both sides — say, a new tool page plus a new resolve path — takes two careful steps instead of one. I accept that. The cost of two uploads is a few minutes. The cost of breaking the downloader for every visitor is a day of confused messages and lost trust.

