1、IIS下Web.config伪静态规则(支持IIS7/IIS8/IIS10)
2、Apache下.htaccess伪静态规则<?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>
3、Nginx下伪静态规则<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>
注意:Nginx中如果站点部署在二级目录,请对应修改重写规则, 如:二级目录为test则:rewrite ^/test/(.*)$ /test/index.php?p=$1 last;location / {
if (!-e $request_filename){
rewrite ^/index.php(.*)$ /index.php?p=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
}
}
希望对大家有帮助。
文章评论 本文章有个评论