Home > Article > Backend Development > Server deployment thinkphp3.1.3 has too many redirects
Recently, a project needs to be migrated from window to linux. There is no problem when running locally. However, when testing on linux, when entering the background system (admin.php), an error message appears. There are too many redirects on the website.
The loading process is admin.php as the entry file, the index controller inherits baseAction, and baseAction has the following code
<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'); } }</code>
Code of Login controller
<code>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'); }</code>
Theoretically, loginAction does not inherit baseAction, so it will not redirect. However, the website still prompts me that there are too many redirects, but the pages under the front-end index.php are all normal, which is backend system redirectiondepressing
The directory structure is:
I tried modifying the pathinfo mode and looked at nginx’s rewrite mode but it didn’t work either