Let’s say that you want to load a directory of images and allow only that directory to be publicly browsable. If you’re running a WordPress site, you will be unable to control directory browsing.
The problem is, due to the custom rewrite rules that WordPress uses, it is not able to recognize sub-directories. WordPress rewrites all URLs in a manner that it assumes the content is supposed to be pulled from its own database. In this example, the images you place in a directory are not part of WordPress.
The simplest way to avoid the WordPress problem and share files is to create a separate subdomain and set it to allowing browsing.
Create a new subdomain
- Log into cPanel.
- Click on Subdomains under the Domain section.
- Add the name of the subdomain you with to create.
- Click on the Document Root box and cPanel will create this for you.
- Click Create.
You will now see the newly created subdomain in the bottom of the dialogue box.
Configure directory browsing
- In the same dialogue box, click on the Document Root link for the subdomain to be taken to the folder in cPanel’s File Manager (Or Select File Manager under Files on your server’s cPanel homepage).
- Click on the public_html directory in the left-hand navigation bar of File Manager.
- Right click on the directory associated with your new subdomain in the main list and select Manage Indicies from the dropdown menu.
- Set to Standard or Fancy Indexing.
You can also password protect the directory. Check out how here.