Pseudo static configuration
Tag function: After the program is configured pseudo-static, the URL will no longer contain the question mark in compatibility mode, making the entire address more beautiful and easier to promote and optimize.
Applicable versions: 2.X, 3.X
1. IIS7+ environment (the environment of IIS6 can be found on Baidu):
1) Install the rewrite component. If you use a space, it is usually installed by default by the space provider;
2) Go to the background configuration parameters and turn on the pseudo-static switch;
3) Create a web.config file in the site directory (you can copy the rules in the rewrite directory of the source code package). The rules are as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="reIndex" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?p={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>2. Apache environment
1) Turn on the Apache rewrite module, please ask Baidu for details. If you use space, the general space provider has been turned on by default;
2) Go to the background configuration parameters and turn on the pseudo-static switch;
3) Create an .htaccess file in the site directory (you can copy the rules in the rewrite directory of the source code package). The rules are as follows:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?p=$1 [QSA,PT,L]
</IfModule>3. Nginx environment
1. Go to the background configuration parameters to enable pseudo-static;
2. Add rules in the nginx virtual host location configuration. The rules are as follows:
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?p=$1 last;
}
}Note: If the site is deployed in the secondary directory in Nginx, please modify the rewrite rules accordingly. For example, if the secondary directory is test, then: rewrite ^/test/(.*)$ /test/index.php?p=$1 last;