I found instructions in a tech blog on disabling the showing of internal directory files by editing the .htaccess file which didn't work. help

Avatar
  • updated
  • Answered

In reading this article about disabling the showing of index files (https://www.wpbeginner.com/wp-tutorials/disable-directory-browsing-wordpress/),  I accessed my .htaccess file and edited it.  It didn't work, I was still able to show the files in the folder wp-includes.

When I looked back at the file on my site, I noticed that the end of the file was not the same as the sample in the article.  It said to look for the end of the file which should read # END WordPress.

Following that line I was to type in: Options -Indexes.  Which I thought I did.  The files still showed.

Then I went back and looked at the .htaccess file.  The last line was different from above.  It read 
# END Wordfence WAF

Now, I don't know what that code means (I do use Wordfence for security), but I wonder if the difference between what I expected to see (# END WordPress) and what was there has anything to do with why I can't stop the directories from showing the files online.

If that's not the issue, then how do I stop the filenames from being revealed online?

Pinned replies
Avatar
Ronnie H.
  • Answer
  • Answered

Hello! Sorry to hear that you ran into trouble blocking directory browsing. Please try using the built in cPanel tool to deactivate indexing on the page/directory and see if that works.

Just as a note, the steps in that article need to be updated slightly. I'll be fixing and updating it within the next few days, but in brief you will need to access the Indexes tool in cPanel, click "edit" for the relevant domain, and select "no indexing". The built-in cPanel tools usually account for any peculiarities of cPanel configurations that would prevent this from working, but please let me know the results and if you are still having the issue we will look into another method. Hope that helps!

Avatar
Ronnie H.
  • Answer
  • Answered

Hello! Sorry to hear that you ran into trouble blocking directory browsing. Please try using the built in cPanel tool to deactivate indexing on the page/directory and see if that works.

Just as a note, the steps in that article need to be updated slightly. I'll be fixing and updating it within the next few days, but in brief you will need to access the Indexes tool in cPanel, click "edit" for the relevant domain, and select "no indexing". The built-in cPanel tools usually account for any peculiarities of cPanel configurations that would prevent this from working, but please let me know the results and if you are still having the issue we will look into another method. Hope that helps!