How to change the name of the data directory on the DEDECMS website?
Now the latest version 5.7 and 5.7SP1 of DEDECMS are available in the background There is a security check. If the data directory uses the default name, the security of the DEDE system will definitely be greatly compromised. I believe everyone has seen this prompt: It is strongly recommended to move the data directory outside the web root directory. See how to relocate
But for virtual hosts, some virtual host restrictions do not allow moving outside the web directory. In order to minimize the possibility of the website being attacked, we can rename the data directory, which further reduces the possibility of attacks. The specific operations are as follows:
Recommended learning: 梦Weavercms
1. Modify the common.inc.php file in the include directory. Open the file and find line 16:
define('DEDEDATA', DEDEROOT.'/data'); Modify data to the directory name you want to change, for example: to asdfg, then change it to:
define('DEDEDATA', DEDEROOT.'/asdfg'); 2. Use FTP to rename the data directory to asdfg, which is the same as the file name changed in the first step.
3. In the website background, go to System-Basic System Parameters-Performance Options, and change "Template Cache Directory:" to: /asdfg/tplcache.
The change is basically completed, but there are still some problems. Open the website directory and you will find that you have jumped to the installation file. Don’t worry, modify the index.php file in the root directory of the website, comment out the first few lines of the file, comment as follows, that is, add // in front of the code:
The code is as follows:
//if(!file_exists(dirname(__FILE__).'/data/common.inc.php')) //{ // header('Location:install/index.php'); // exit(); //}
In this way, your website can be opened normally. When updating in the background, there are still problems. There are problems with the website map and RSS and JS updates. Then we only need to create a new data directory under the website root directory, and then create two new rss and js directories under the data directory. , that’s it, update it again and see if everything is normal?
Note: The change directory mentioned above is asdfg, where asdfg can be freely replaced with the directory name you want.
The above is the detailed content of How to change the data directory name on the DEDECMS website. For more information, please follow other related articles on the PHP Chinese website!