一:带标识符的伪静态写法
.htaccess 的规则 (根目录下的),html是默认的,对应后台系统设置里的伪静态标识符
-------------------------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^html/(.*)$ index\.php\?$1 [QSA,PT,L]
</IfModule>
-------------------------------------------------------------------------------------------
httpd.ini 的规则
-------------------------------------------------------------------------------------------
[ISAPI_Rewrite]
RepeatLimit 32
RewriteRule ^/html/(.*)$ /index\.php\?$1
-------------------------------------------------------------------------------------------
nginx 的规则
-------------------------------------------------------------------------------------------
if (!-e $request_filename){ rewrite ^/html/(.*)$ /index.php?$1 last;
}
-------------------------------------------------------------------------------------------
web.config 的规则
-------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="vivi_wanneng" stopProcessing="true">
<match url="html/(.*)$" />
<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
-------------------------------------------------------------------------------------------
二:不带标识符的伪静态写法(即:和目标站一样的URL地址)
注意:需要把后台文件夹重命名为@开头,如:@admin,否则无法访问后台
.htaccess 的规则, apache的
-------------------------------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^@]+)$ index\.php\?$1 [QSA,PT,L]
</IfModule>
-------------------------------------------------------------------------------------------
httpd.ini 的规则,一般用于iis6
-------------------------------------------------------------------------------------------
[ISAPI_Rewrite]
RepeatLimit 32
RewriteRule ^/([^@]+)$ /index\.php\?$1
-------------------------------------------------------------------------------------------
nginx 的规则
-------------------------------------------------------------------------------------------
if (!-e $request_filename){
rewrite ^/([^@]+)$ /index.php?$1 last;
}
-------------------------------------------------------------------------------------------
web.config 的规则,用于 iis7以上
-------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="vivi_wanneng" stopProcessing="true">
<match url="^([^@]+)$" /> <conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
-------------------------------------------------------------------------------------------