Home > Operation and Maintenance > Nginx > How to hide the suffix name php in nginx

How to hide the suffix name php in nginx

王林
Release: 2020-09-11 14:52:28
Original
6204 people have browsed it

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;].

How to hide the suffix name php in nginx

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

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!

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 Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template