To achieve better SEO optimization, we need to hide the index in the URL address. php, because the configuration methods of different server environments are quite different, we can refer to 5.9URL rewriting for the configuration under the apache environment, so I will not talk about it. here I will explain IIS and Nginx.
To achieve better SEO optimization, we need to hide the index in the URL address. php, because the configuration methods of different server environments are quite different, we can refer to 5.9 URL rewriting for the configuration in the apache environment, the following describes the basic configuration methods and ideas under IIS and Nginx.
IIS environment
If your server environment supports ISAPI_Rewrite, you can configure the httpd. ini file and add the following content:
RewriteRule (. *) $/index \. php \? S = $1 [I]
In the later version of IIS, you can configure web. Config and add a rewrite node in the middle:
- Name = "OrgPage" stopProcessing = "true">
- Url = "^ (. *) $"/>
- LogicalGrouping = "MatchAll">
- Input = "{HTTP_HOST}" pattern = "^ (. *) $"/>
- Input = "{REQUEST_FILENAME}" matchType = "IsFile" negate = "true"/>
- Input = "{REQUEST_FILENAME}" matchType = "IsDirectory" negate = "true"/>
- Type = "Rewrite" url = "index. php/{R: 1}"/>
Nginx environment
In earlier versions of Nginx, PATHINFO is not supported, but you can configure forwarding rules in Nginx. conf:
- Location /{//..... Partial code omitted
- If (! -E $ request_filename ){
- Rewrite ^ (. *) $/index. php? S = $1 last;
- Break;
- }
- }
In fact, it is forwarded to the compatible URL 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, the pseudo-static method of Nginx is set as follows, where youdomain is the directory name.
- Location/youdomain /{
- If (! -E $ request_filename ){
- Rewrite ^/youdomain/(. *) $/youdomain/index. php? S = $1 last;
- }
- }