I have moved wp-config.php but my file structure is as given below:


abcom and applecom folder has wordpress websites both As advised, I have moved wp-config.php outside abccom for security, but now when I need to do the same for applecom, how can I achieve it?



1 Answer 1


Move wp-config.php to its new location somewhere above "public_html" and add a new "skeleton" wp-config.ph in the WordPress directory e.g.


The wp-config.php script is included by other WordPress files. So to include this from a non default location we can simply 1. move our "real" wp-config from the Wordpress directory to where we want it located. 2. create a new wp-config in the Wordpress directory that does its own includes of the "real" wp-config script.

The benefits of having this file above public_html/web-root are hotly debated. I am in the camp that wants to avoid having scripts with authentication keys, salts & DB "credentials" in a directory that might be accessed via HTTP(S).

There are no real benefits in moving wp-config to another accessible dir (this may be the case for "abccom" where you have moved it to a dir "public_html" which usually indicates it is yes "public".

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