Ok, many may not agree with me as this involves editing 2 core files, but I prefer the protection it gives versus the redirect and it allows me to continue to make changes to the configuration.php file through my normal Joomla interface.
WARNING: Do not attempt this procedure unless you understand what you are doing and are willing to possibly break your site while testing. This is not for beginners or inexperienced persons, ensure you have a back up of your site before attempting.1) Create a directory immediately above your public web directory (which is often public_html). I'll call this directory "configuration" all lower case, quotes aren't part of the directory name.
2) Place a copy of your current configuration.php file, completely unaltered and NOT renamed into this directory. I have permissions set at 644 on the file in this directory.
3) Go to the /includes directory in the root of your Joomla install and backup the file defines.php
4) Go to the /includes directory in the root of your Joomla install and open the file defines.php in your favorite editor
5) Around line 26 you will see this:
Code:
define( 'JPATH_CONFIGURATION', JPATH_ROOT );
6) Replace it with this
Code:
define( 'JPATH_CONFIGURATION', JPATH_ROOT.DS.'..'.DS.'configuration' );
where the second bolded lower case word "configuration" is the CaSE sENsITiVE name of the directory you created in step 1. DO NOT remove spaces, periods, or anything else from this line or it won't work! Also, make certain there are no extra spaces after the last semi colon on the line.
6) Save and upload the file.
7)
Repeat these exact same steps with the exact same file (defines.php) that is located in the rootofyourjoomlainstall/administrator/includes/ directory. If you don't do this access to your admin area will be prevented8 ) Go to the root of your installation and rename the configuration.php file to something like somefile.html or whatever.
9) Go to your website and test as many pages as you can to make certain it is working.
10) Delete the old renamed configuration.php file from the root of your Joomla installation
11) Retest your website thoroughly
11) Make sure you add the new directory with the configuration.php file in it to your backup job so it doesn't get missed.
P.S. If you go more than the level immediately above your web root you need to add slashes and dots like:
Code:
define( 'JPATH_CONFIGURATION', JPATH_ROOT.DS.'/../..'.DS.'configuration' );
or something similar.
WARNING: Do not attempt this procedure unless you understand what you are doing and are willing to possibly break your site while testing. This is not for beginners or inexperienced persons, ensure you have a back up of your site before attempting.
Enjoy!
Any feedback is always welcome.
Cheers,
Wayne