I’m looking to establish custom folders in the media upload directory of my WordPress site. When I create new folders using FTP or the cPanel file manager in the wp-content/uploads directory, they aren’t visible online. For instance, I made a folder named “custom-files” in the uploads area, but accessing mysite.com/wp-content/uploads/custom-files/ results in a 404 error. What’s the right way to set up these folders so they can be seen on the web? I prefer not to use any plugins for this and want to manage it through code or correct file permissions. What steps should I follow to make sure these subfolders appear correctly?
That 404 error is probably WordPress’s default .htaccess blocking access to your directory. I hit this same problem setting up a document library for a client. Here’s what fixed it: Create a new .htaccess file inside your custom-files folder with Options +Indexes and Allow from all. Also check your folder permissions - they should be 755. Another thing - some hosting providers add extra security restrictions to the uploads directory. I’ve seen shared hosts do this a lot. If the .htaccess fix doesn’t work, you’ll need to contact your host to whitelist the directory or tweak their server settings.
WordPress blocks direct access to certain directories by default. When you manually create folders in wp-content/uploads, they’re on the server but WordPress won’t let people access them through the web. I hit this exact issue building a client portal last year. Two things fix it: make sure your folder permissions are set to 755, then tell WordPress to allow access. You can add rewrite rules to your main .htaccess file or create an index.php file in your custom folder to handle requests. Sometimes it’s just your web server’s configuration blocking static files in the uploads directory.
your server’s blocking directory browsing. had the same issue when i set up downloads for my portfolio. drop a blank index.html file in your custom-files folder - that usually fixes it. if not, your uploads folder probably has security rules blocking new subdirectories unless wordpress registers them properly.
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.