Home » WordPress Tutorials » Maintenance » Can Directory Indexing be Turned Off in WordPress

Can Directory Indexing be Turned Off in WordPress

Maintenance

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:

website directory indexing shows files that comprise your website

 

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:

Access the File Manager in the AwardSpace hosting panel

 

After that, open the directory of your website. Once you do, find a file called .htaccess and open it:

locate the .htaccess file on your website

 

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

add a code snippet at the end of the document

 

Then, click the Save button at the top right of the page, so you apply the changes.

Save the changes, so AwardSpace applies them to your website

 

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.

Was this post helpful?

i

Relevant tags:

Create your WordPress website today!

Connect

Editor’s picks:

Gutenberg Tutorial: How to Move Blocks in WordPress

What you need to know: The WordPress Block Editor allows you to move blocks up and down the document structure in order to rearrange the content contained within those blocks. The most popular way of moving blocks is by dragging a block from one position and dropping...

Gutenberg Tutorial: Deleting a Block in WordPress

What you need to know: You can delete a block in WordPress by selecting it and pressing the Delete key on your keyboard. Alternatively, you can press the three-dot button in the Contextual Toolbar to access the Remove block option. Lastly, it is also possible to...



Create your WordPress website today!


Start now