Due to project needs, the project that used Apache as the server in the past needs to be changed to Nginx, but after the change, a problem occurred. When accessing directly using the domain name, it prompts "The webpage cannot operate properly. There have been too many redirects ERR_TOO_MANY_REDIRECTS" ".
Through step-by-step breakpoint output of the code, we found that the reason is that the default access module (default controller and default method) or the default access module (default controller and default method) has not been set. Default controller and default method) do not exist. So this is the reason.
The solution is as follows: (Recommended learning: PHP video tutorial)
The homepage directly configures the jump to admin.php, but due to \thinkphp In the \library\think\Request.php file, the pathinfo() function returns $this->pathinfo;
The result is '/', in this case, the default setting will be found in the configuration file. Controllers and operations, because this default access module, controller, and method are not performed, the "Too many redirections" error is returned.
We only need to change the default_module (default module name) configuration, default_controller (default controller name) configuration and default_action (default operation method name) configuration in the \application\config.php configuration file in tp5 to existing ones Just controllers and methods:
// 默认模块名 'default_module' => 'home', // 默认控制器名 'default_controller' => 'Index', // 默认操作名 'default_action' => 'index',
The above is the detailed content of How to solve too many redirects in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor
