The latest release of Phpcms V9 because of the MVC design pattern, so its background access address is fixed, although you can modify the routing configuration file to implement the modification, but each time the routing configuration file is a bit of a problem for me, and accidentally error. Here to use another one once and for all, to facilitate the modification of access to the background entrance, the whole modification is divided into two steps:
The first step:
Create a folder at the root of the Web site, will be through this folder to enter the background login interface, so the folder name is not easy to guess the name of a person easily guessed. Here as a demonstration, I'll take it as a admpub. Next, create a new file index.php in this folder, with the following contents:
<?php define (' Phpcms_path ', Realpath (dirname). ‘/..‘) . ‘/‘);
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[' right_enter '] = 1;
unset ($session _storage);
Header (' Location:.. /index.php?m=admin ');
Step Two:
Create a new file my_index.php in the Phpcms/modules/admin/folder with the following contents:
<?php defined (' In_phpcms ') or exit (' No permission resources. ');
Class My_index extends Index {
Public Function __construct () {
if (Empty ($_session[' right_enter ')) {
Header (' location:./');
Exit
}
Parent:: __construct ();
}
Public Function Public_logout () {
$_session[' right_enter '] = 0;
Parent:: Public_logout ();
}
}
OK, the modifications are complete. In the future only through the admpub/directory access to the background login portal, if directly using Index.php?m=admin access, will jump directly to the homepage of the site, which prevents the background login access to the portal directly.
PHPCMS Background Login Path Modification method (V9 version)