Home > Article > Operation and Maintenance > How to hide the suffix name php in nginx
How to hide the php suffix in nginx: First open the nginx.conf configuration file; then add the content [ttry_files $uri $uri/ $uri.php$is_args$args;].
Specific method:
(Recommended tutorial: nginx tutorial)
First open nginx. conf configuration file;
Then add the following content to the configuration file:
location / { ttry_files $uri $uri/ $uri.php$is_args$args; }
This way you can hide the suffix name .php.
Description:
try_files is an instruction in nginx, somewhat similar to rewrite, used to try to find the file or directory with the path specified after the instruction and return.
$uri represents the URI path of the current request, which is the path behind the URL domain name, without parameters.
$ is_args means that if there are parameters in the requested URL, $is_args represents "?". If there are no parameters in the requested URL, an empty string will be returned for passing parameters.
$args represents the complete parameters in the request URL.
Related recommendations: php training
The above is the detailed content of How to hide the suffix name php in nginx. For more information, please follow other related articles on the PHP Chinese website!