.htaccess file recommended for subfolder install of WP

Hi all,

Can anyone recommend what the contents of an .htaccess file should be for a subfolder install of WP?

I have multiple WP installs, one at the public_html level of my hosting and another in a subfolder. Recently I compared the .htaccess files and they are different.

The .htaccess file at the public_html level blocks access to critical WP files e.g. wp-config.php but the .htaccess file for the subfolder install does not.

Im not sure if the blocks to access of critical WP files should be included in each .htaccess file for each install of WP.

Can anyone advise what should be done?

  • Predrag Dubajic
    • Support

    Hey @Glenn,

    Hope you're doing well today :slight_smile:

    The .htaccess file of your main installation should not affect the files from your subfolder installation so you should set subfolder .htaccess separately for that WP installation.

    Let me know if you have more questions about this.

    Best regards,

  • o_be_one
    • WPMU DEV Initiate

    Hello there, i've the same question regarding WP Defender and it's offer to securise with .htaccess.
    I wanted to know how to deal with it manually instead of automatic way, cause my configuration doesnt allow me to let defender edit my htaccess (or create) in subfolders.

    Thanks !

  • Adam Czajczyk
    • Support Gorilla

    Hello o_be_one,

    I hope you're well today!

    The simplest solution would be to make sure that folder permissions are set to 755 and .htaccess is made writable to let Defender deal with it automatically as it not only adds up to an existing file but also creates additional files inside folders of your install (depending on the "Hardener" options that you select).

    If this doesn't work for you or is not an acceptable solution, please start a separate thread of your own on our Support Forum here:

    This way will be able to assist you faster and in more accurate way and also it will be easier for other members of our community to find the solution in case they came across similar issues. We also avoid sending a lot of unnecessary notifications straight to the Glenn's (original poster here) inbox :slight_smile:

    Best regards,

  • o_be_one
    • WPMU DEV Initiate

    Hello Adam,

    thanks a lot for your informations and sorry for this quite long time before answering, i was really busy (like we are all, no :slight_smile: ?).

    Well, i totally understand your point. But in my side, i'm my own provider and i've configured my webserver in a way that i'm not allowed to play easily as just changing chmod for my folders.
    Anyway, i have to work again on my installation cause my website is really slow when WPMU is installed, that's weird, i think i've missed something in documentation i'll check :slight_smile:. If i need something i'll open or search threads no problem.

    Thanks a lot !

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.