I am trying to emulate the appearance of multiple subfolders of files in the installations root directory, but these folder names will conflict with pages that need to be the same name.
In other words, I want to media files to appear as if they were in the same folder as the page as if it the page URL was a real folder.
Example:
http://example.com/courtcase/ would be the page for a court case and http://example.com/courtcase/testimony.pdf would be a document referenced in it
I COULD change the upload directory to the install root and then subfolders using a plugin that allows organizing media files this way. HOWEVER, calling on the page slug will cause the server to open the file directory for the actual folder rather than the page in the WP database.
So all I would need is to have the media files in another directory than the install to eliminate conflicts, and then have slugs for files just start at the install directory path.
Example: http://example.com/wp-content/uploads/courtcase/testimony.pdf would become http://example.com/courtcase/testimony.pdf
And of course I would need this done for all media files, not manually adding redictects.
{NOTE: This is a client requirement. Yes, it's crazy to be so concerned with URLS, but that's the demand for the project and they will not be swayed to accept any other result.}
attachment
with its own URL, comments, post meta, and template? Note that the WP rewrite URLs system isn't used for uploads, so there would be a non-trivial performance cost to do this, especially for large files which may trigger the execution time limit. Tell your client that what they ask is nontrivial and make sure they pay the extra for such an unusual ask