I've created a custom post type for my landing pages, which each sit at
I want to keep those custom posts there, so they show up with proper featured images and excerpts on archive and search pages. However, in some cases, if someone goes to a specific page, I want it to load a static page, and associated style sheets and scripts from the directory where the static page is.
So, imagine the following URI hierarchy:
/page-b/ // this page exists in WP for search/archive purposes
The above pages all exist in WordPress and work fine. Now, there could be a directory structure on the server like
If someone navigates to
page-x.html exists in
/foo, I want it to load that, and I want relative references internal to
<script id="page-x-js" src="./public/page-x.js" defer></script>) to pull from that directory path. But if they go to
/vhost/mysite/www/foo/page-a.html doesn't exist, I want WordPress to load the normal, internal custom post.
The directory structure doesn't really matter — I have full control over the server. And while I assume this is some
.htaccess magic, I'm running Apache and can make changes to the config, or I could even add code to my plugin that creates the custom pages.
Anyone know how I can accomplish this?