Home >CMS Tutorial >PHPCMS >How to change the phpcms background path
How to modify the phpcms background path:
Method 1: Change it to a second-level domain name in the management background.
##In the management background: Settings > Related Settings > Security Configuration > Backend access domain name, enter the custom second-level domain name admin.cmsyou.com, You can only log in through this domain name (if you need to remove the binding, you need to modify the parameter admin_url in /caches/configs/system.php to manually cancel the binding). After that, admin.cmsyou.com is resolved to this host in the domain name resolution, and the host is also bound to it. In addition, the default index order index.php is set first, so that the management backend entrance is modified.Method 2: Determine the management entrance based on the custom SESSION value.
This method requires modifying the default phpcms php file, customizing a portal to start SESSION, and then judging the SESSION. If it matches, log in, if not, jump to the home page. CMSYOU currently uses this method. 1. Modify the \phpcms\modules\admin\index.php file and add at the beginning of the public function __construct() method://login diy if (empty($_SESSION['cms_login'])) { header('location:'.APP_PATH); exit; }Also find the public function public_logout() method, in the sentence First add the line
$_SESSION['cms_login'] = 0;. This will clear the cms_login SESSION value after exiting. 2. Then customize a php file to enable the cms_login SESSION value for matching: Create a new admin\ directory in the root directory of the website, and create a new file index.php in this directory. The content is as follows:
<?php define('PHPCMS_PATH', realpath(dirname(__FILE__) . '/..') . '/'); include PHPCMS_PATH . '/phpcms/base.php'; // pc_base::creat_app(); $session_storage = 'session_' . pc_base :: load_config('system', 'session_storage'); pc_base :: load_sys_class($session_storage); session_start(); $_SESSION['cms_login'] = 1; unset($session_storage); header('location:../index.php?m=admin'); ?>PHP Chinese website, a large number of free
PHPCMS tutorials, welcome to learn online!
The above is the detailed content of How to change the phpcms background path. For more information, please follow other related articles on the PHP Chinese website!