Home > Backend Development > PHP Tutorial > Regarding server deployment thinkphp3.1.3 has too many redirects

Regarding server deployment thinkphp3.1.3 has too many redirects

PHP中文网
Release: 2023-03-01 08:40:01
Original
2320 people have browsed it

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');
        }
    }
Copy after login

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');
    }
Copy after 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:

Regarding server deployment thinkphp3.1.3 has too many redirects

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");
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template