Below are instructions to move the configeration.php file out of the public_html folder. The code they use show how to move the configuration one folder up.
I have my joomla installation in a joomla folder inside the public html folder. Therefore, I have to move two folders up. What is the code I need to add to the two designated spots to do that? I want the file in a folder called "security".
Step 1 : Move configuration.php to a safe directory outside of public_html.
Step 2: You will have to modify the /includes/defines.php and /administrator/includes/defines.php files, more precisely, this constant:
define( 'JPATH_CONFIGURATION', JPATH_ROOT );
If, for example you wish to move the file up one level and into a folder named "test" the constant will look like this:
define( 'JPATH_CONFIGURATION', JPATH_ROOT.DS.'..'.DS.'test' );
Step 3: Make sure the configuration.php is not writable at all, so that it can not be overridden by com_config.
Step 4: If you need to change configuration settings, do it manually in the relocated configuration.php