各服务器环境伪静态规则
iis6下# FR-HRCMS PHP2.0
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteRule ^(.*)/index.html\?*(.*)$ $1/index.php\?$2
RewriteRule ^(.*)/(+)-(+)-(+)\.html\?*(.*)$ $1/$2\.php\?$3=$4;$5
RewriteRule ^(.*)/(+)-(+)-(+)-(+)\.html\?*(.*)$ $1/$2\.php\?$3=$4;page=$5;$6
RewriteRule (+)-(+)-(+)\.html\?*(.*)$ $1\.php\?$2=$3;$4
以上代码复制到命名为httpd.ini文件中,在服务器IIS上设置支持Rewrite,然后在后台开启伪静态,清理缓存。
apache下.htaccess
apache下.htaccess文件规则代码# 将 RewriteEngine 模式打开
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/index.html\\?*(.*)$ $1/index.php\\?$2
RewriteRule ^(.*)/(+)-(+)-(+)\\.html\\?*(.*)$ $1/$2\\.php\\?$3=$4;$5
RewriteRule ^(.*)/(+)-(+)-(+)-(+)\\.html\\?*(.*)$ $1/$2\\.php\\?$3=$4;page=$5;$6
RewriteRule (+)-(+)-(+)\\.html\\?*(.*)$ $1\\.php\\?$2=$3;$4
IIS7伪静态规则
IIS7伪静态规则在web.config文件中具体规则代码为
<rule name=\"fr_rewrite_1\">
<match url=\"^(.*)/index.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/index.php?{R:2}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_2\">
<match url=\"^(.*)/(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/{R:2}.php?{R:3}={R:4};{R:5}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_3\">
<match url=\"^(.*)/(+)-(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/{R:2}.php?{R:3}={R:4};page={R:5};{R:6}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_4\">
<match url=\"(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}.php?{R:2}={R:3};{R:4}\" appendQueryString=\"false\" />
</rule>
完整的web.config文件参考代码为
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=\"fr_rewrite_0\">
<match url=\"^(.*)\\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$\" />
<action type=\"Rewrite\" url=\"/404.php\" />
</rule>
<rule name=\"fr_rewrite_1\">
<match url=\"^(.*)/index.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/index.php?{R:2}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_2\">
<match url=\"^(.*)/(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/{R:2}.php?{R:3}={R:4};{R:5}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_3\">
<match url=\"^(.*)/(+)-(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}/{R:2}.php?{R:3}={R:4};page={R:5};{R:6}\" appendQueryString=\"false\" />
</rule>
<rule name=\"fr_rewrite_4\">
<match url=\"(+)-(+)-(+)\\.html\\?*(.*)$\" ignoreCase=\"false\" />
<action type=\"Rewrite\" url=\"{R:1}.php?{R:2}={R:3};{R:4}\" appendQueryString=\"false\" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
nginx下规则代码
nginx下规则代码rewrite ^/index.html$ /index.php last;
rewrite ^/(.*)/index.html$ /$1/index.php last;
rewrite ^/(.*)/(+)-(+)-(+).html$ /$1/$2.php?$3=$4 last;
rewrite ^/(.*)/(+)-(+)-(+)-(+).html$ /$1/$2.php?$3=$4;page=$5 last;
rewrite ^/(+)-(+)-(+).html$ /$1.php?$2=$3 last; 嘻嘻嘻分享 nginx下规则代码
rewrite ^/index.html$ /index.php last;
rewrite ^/(.*)/index.html$ /$1/index.php last;
rewrite ^/(.*)/(+)-(+)-(+).html$ /$1/$2.php?$3=$4 last;
rewrite ^/(.*)/(+)-(+)-(+)-(+).html$ /$1/$2.php?$3=$4&page=$5 last;
rewrite ^/(+)-(+)-(+).html$ /$1.php?$2=$3 last;
rewrite ^/(hr|help)/(+).html$ /$1/$2.php?$3 last;
rewrite ^/(.*)/(+)-(+).html$ /$1/$2.php?page=$3 last
IIS7伪静态规则在web.config文件中
具体规则代码为
<rule name=\"fr_rewrite_1\">
<match url=\"^(.*)/index.html\\?*(.*)$\" ign... 这个只有资讯伪静态了,设置之后企业页面 职位页面都打不开了!
页:
[1]