Disable DirectoryIndexes
Posted by Phillip Baker on 10 August 2020 08:00 PM

Server Wide

Log in to WHM as root

Navigate to the Apache Configuration section (Service Configuration -> Apache Configuration, or use the search function)

Click on Global Configuration

Scroll down to 'Directory "/" Options'

Uncheck "Indexes"

Scroll to the bottom and click Save

Click Rebuild Configuration and Restart Apache

Individual Account (or Directory)

Log in to the cPanel interface as the user in question

Go to Advanced -> Indexes (or search for "indexes")

Navigate to the folder you wish to disable Indexes for and click "Edit" - if you want to disable it for the entire default site document root, click "Edit" next to "public_html"

Set your Index preferences as you wish - if you want to disable it, select "No Indexing". "Inherit" will follow whatever the parent directory or system default is.

Click Save

Repeat for any other directories you wish to change indexing for

Off Server Wide but on for specific Directory

Complete the first section

Then use the second section and turn Indexing *on* ("Show Filename and Description" is the default Apache style) for the directory instead of using "Inherit" (which will now be set to have indexes disabled)

(2 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).