sitemap.php permission


I have followed the install instructions for the simple sitemaps plugin. When I navigate to in my browser I get the following error:


You don’t have permission to access /wp-content/sitemap.php on this server.

Possible causes of this error include:

The request was forbidden by rules in the .htaccess file.

The directory you requested does not have an index.html or index.php file.

The permissions on the file or directory are incorrect.

For details about why the request was forbidden, see the Apache error log at:


I have set the file permissions to 777, and checked that the indax.php file is in the directory.

What can I do to fix this?

  • Kasia Swiderska
    • Support nomad

    Hello mcneela86,

    Can you check if you have additional htaccess file in wp-content directory from Defender? I can see that you are using it, so it might be that one of the hardening recommendation is blocking that file.

    If you find that htaccess inside wp-content directory, add there in that file this code

    <Files sitemap.php>
    Allow from all

    that should exclude file and site maps should start working.

    kind regards,


  • mcneela86
    • WPMU DEV Initiate

    Hi Kasia,

    I have located the .htaccess file inside wp-content, I added the code you mentioned, it not looks like this:

    ## WP Defender – Prevent PHP Execution ##

    <Files *.php>

    Order allow,deny

    Deny from all


    Files sitemap.php>

    Allow from all


    ## WP Defender – End ##

    I get a different error:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    The most common causes of this problem are errors in the app’s .htaccess file or incorrect file or directory permissions preventing the web server from reading the .htaccess file.

    More information about this error is available in the app’s Apache error log at:


  • Dimitris
    • Support Star

    Hey there mcneela86,

    hope you’re doing good and don’t mind chiming in! :slight_smile:

    It seems that there was an error in your code, a missing opening <Files> tag.

    Could you please use the following snippet instead and check how that goes?

    ## WP Defender - Prevent PHP Execution ##
    <Files *.php>
    Order allow,deny
    Deny from all
    ## WP Defender - End ##
    <Files sitemap.php>
    Allow from all

    Warm regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.