In short, yes, directory indexing can be disabled in WordPress. This article explains what directory indexing is, why it is a good idea to disable it, and how to do so.
What is Directory Indexing
Directory indexing (or directory browsing) is a server feature that allows website visitors to browse the contents of a given website. This means that when directory indexing is enabled, you can browse all files and folders that comprise a given website.
Directory indexing includes files and folders, information about their names, sizes, and modification dates. Also, it is common that indexing also reveals file permissions and file types.
Why Should You Disable Directory Indexing in WordPress
It is highly advisable to disable directory indexing for your website. There are many reasons why:
- Privacy and security. Enabling directory browsing can expose sensitive information about your website’s file structure, file names, and other content. Hackers can exploit this information and access sensitive data about you and your visitors.
- Unauthorized access. Keeping directory browsing enabled provides access to files that are not intended to be accessed by users.
- Search engine optimization (SEO). Keeping directory indexing can harm your website’s SEO. This is because, in the context of enabled directory indexing, search engines may index numerous URLs pointing to the same content. In short, directory browsing contributes to duplicate content, which is considered a bad SEO practice.
How to Check Whether Directory Indexing is Enabled in WordPress
The fastest way to check whether directory indexing is enabled on your website is by adding /wp-includes at the end of your website’s domain name. For example:
https://www.yourwebsite.com/wp-includes
Should directory indexing be enabled, you will see a list of the files comprising your website, such as this one:
However, if directory browsing is disabled, the https://www.yourwebsite.com/wp-includes URL will lead to a 403 Error Forbidden. This is a rare scenario in which an error message means that you have done the right thing for your site.
How to Disable Directory Indexing in WordPress
A simple way of turning off directory indexing in WordPress is via the hosting panel. Here’s how to proceed.
First, log in to the AwardSpace hosting panel.
Then, head to File Manager:
After that, open the directory of your website. Once you do, find a file called .htaccess and open it:
When you open the file, scroll to the bottom of the code string and add this snippet at the end of the document:
options-indexes
Then, click the Save button at the top right of the page, so you apply the changes.
Now you have managed to disable the directory indexing for your website.
Conclusion
Directory indexing can be turned off in WordPress by following a few simple steps. In this article, we shared how to do so and why it is a good idea to keep directory indexing disabled at all times.