Home >Backend Development >PHP Tutorial >lnmp enable pathinfo and hide index.php, lnmppathinfo_PHP tutorial
Edit the following section:
location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; }
location ~ [^/]\.phpLine 4 Comment out the line, that is, add # in front of it
#try_files $uri =404;Remove the comment on line 8
include pathinfo.conf;Add a section above location ~ [^/].php
location / { if (!-e $request_filename) { rewrite "^/(.*)$" /index.php last; } }Restart Nginx
service nginx restart