WordPress.org

Support

Support » How-To and Troubleshooting » block folder listing with .htaccess

block folder listing with .htaccess

  • If top of WP .htaccess has

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # Prevents directory listing
    IndexIgnore *
    # END WordPress

    does this protect all lower folders from being listed?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    You can add this code in htaccess to prevent directory listing:

    Options -Indexes

    or

    IndexIgnore *

    Thanks,

    Shane G.

    Thanks. But does that also protect lower levels?
    Hackers have gotten to some of my index.php in lower levels before I started learning more about wp security.

    Hi,

    If you do not have added any other htaccess file in the lower level folders then it will executes the rules of the main htaccess folder which does not allow to access any of the folder.

    If any htaccess file under the lower level folder then it will execute that rules so you have to add this code in that htaccess file too.

    Thanks,

    Shane G.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘block folder listing with .htaccess’ is closed to new replies.
Skip to toolbar