Thinkphp supports PATHINFO in earlier versions of Nginx, nginxpathinfo. Thinkphp supports PATHINFO sharing in earlier versions of Nginx. nginxpathinfo recently used thinkphp for a project, after deployment to the nginx server, we found that nginx does not support thinkphp and supports PATHINFO in earlier Nginx versions. nginxpathinfo
I recently used thinkphp to build a project. after deployment to the nginx server, I found that nginx does not support pathinfo. how can I deal with it.
Nginx environment
In earlier versions of Nginx, PATHINFO is not supported. However, in Nginx. conf (in/usr/local/nginx/conf/nginx. conf or use find/| grep nginx. configure the forwarding rule implementation in the nginx configuration file:
location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; }}
In fact, the URL is forwarded to the compatible mode provided by ThinkPHP. this method can be used to solve other WEB server environments that do not support PATHINFO.
If your ThinkPHP is installed in the second-level Directory, set the pseudo-static method of Nginx as follows, where youdomain is the directory name.
location /youdomain/ { if (!-e $request_filename){ rewrite ^/youdomain/(.*)$ /youdomain/index.php?s=$1 last; }}
For example:
location /thinkphp/ { if (!-e $request_filename){ rewrite ^/thinkphp/(.*)$ /thinkphp/index.php?s=$1 last; }}
Syntax: rewrite regex replacement flag (last is equivalent to the [L] Mark in apache, indicating rewrite .)
PATHINFO is supported under idea. nginxpathinfo recently used thinkphp to build a project. after deployment to the nginx server, nginx is not supported...