How to change location of wp-config.php to folder or 2 folders up?

I read somewhere its good to put it out of public_html but since im using subfolder then i need to put it 2 levels up.

1 Answer 1


You shouldn't move the file because you'd have to change other files which include wp-config.php and these files will be overridden at your next update, but you can move the content of the file ( at least your credentials) to another file two levels up and include() this file in your wp-config.php This solution should be update save

  • Note that one of unobvious downsides of include-nested config is that it wrecks WP CLI, which relies on parsing config file as text to boot WP core.
    – Rarst
    Feb 3, 2017 at 20:43
  • Yes. Of course- save and safe! How to make it?
    – Kangarooo
    Mar 8, 2017 at 2:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.