A recent project needs to be migrated from window to linux. There is no problem when running locally. However, when testing on linux, when entering the backend system (admin.php), an error message appears. The website has too many redirects.
The loading process is admin.php As the entry file, the index controller inherits baseAction, and baseAction has the following code
class IndexAction extends BaseAction { public function index() { //indexAction.class.php } } class BaseAction extends Action { //BaseAction.class.php public function _initialize() { if (!$this->isLogin()) { $this->redirect('Home/Login/index'); } }
The code of the Login controller
class LoginAction extends Action { /** * 显示登录页面 */ public function index() { if (!empty($_SESSION[C('SESSION_ADMIN_NAME')]) && !empty($_SESSION[C('SESSION_ADMIN_ID')]) && strtolower(ACTION_NAME) != 'logout') { $this->redirect("Index/index"); } $this->display('login'); }
Theoretically, loginAction does not inherit baseAction, so it will not redirect. However, the website still prompts me that there are too many redirects. Orientation, but the pages under the front-end index.php are normal, but the back-end system redirection is frustrating
The directory structure is:
I tried to modify the pathinfo mode, but it didn’t work after looking at nginx’s rewrite mode
Solution:
Use the stupidest method, start from the entry file admin.php, trace and print one by one and end it to see where the problem is, similar to the little yellow duck debugging method, haha
exit("123");