Apache服务器

根目录下.htaccess文件:

  1. RewriteEngine On
  2. ErrorDocument 404 /404.html
  3. Rewritebase /
  4. #信息列表
  5. RewriteCond %{QUERY_STRING} ^(.*)$
  6. RewriteRule ^listinfo-(.+?)-(.+?)\.html$ /e/action/ListInfo/index\.php\?classid=$1&page=$2
  7. #信息内容页
  8. RewriteCond %{QUERY_STRING} ^(.*)$
  9. RewriteRule ^showinfo-(.+?)-(.+?)-(.+?)\.html$ /e/action/ShowInfo\.php\?classid=$1&id=$2&page=$3
  10. #标题分类列表页
  11. RewriteCond %{QUERY_STRING} ^(.*)$
  12. RewriteRule ^infotype-(.+?)-(.+?)\.html$ /e/action/InfoType/index\.php\?ttid=$1&page=$2
  13. #TAGS信息列表页
  14. RewriteCond %{QUERY_STRING} ^(.*)$
  15. RewriteRule ^tags-(.+?)-(.+?)\.html$ /e/tags/index\.php\?tagname=$1&page=$2
  16. #评论列表页
  17. RewriteCond %{QUERY_STRING} ^(.*)$
  18. RewriteRule ^comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)\.html$  /e/pl/index\.php\?doaction=$1&classid=$2&id=$3&page=$4&myorder=$5&tempid=$6

 

IIS6服务器

根目录下httpd.ini

  1. [ISAPI_Rewrite]
  2. # 3600 = 1 hour
  3. CacheClockRate 3600
  4. RepeatLimit 32
  5. #信息列表
  6. RewriteRule ^(.*)listinfo-(.+?)-(.+?)\.html$ $1/e/action/ListInfo/index\.php\?classid=$2&page=$3
  7. #信息内容页
  8. RewriteRule ^(.*)showinfo-(.+?)-(.+?)-(.+?)\.html$ $1/e/action/ShowInfo\.php\?classid=$2&id=$3&page=$4
  9. #标题分类列表页
  10. RewriteRule ^(.*)infotype-(.+?)-(.+?)\.html$ $1/e/action/InfoType/index\.php\?ttid=$2&page=$3
  11. #TAGS信息列表页
  12. RewriteRule ^(.*)tags-(.+?)-(.+?)\.html$ $1/e/tags/index\.php\?tagname=$2&page=$3
  13. #评论列表页
  14. RewriteRule ^(.*)comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)\.html$  $1/e/pl/index\.php\?doaction=$2&classid=$3&id=$4&page=$5&myorder=$6&tempid=$7
  15. #搜索伪静态

 

IIS7服务器

根目录下的web.config:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4. <!--帝国7.2默认规则 IIS7的rule name不能重复相同-->
  5. <rewrite>
  6. <rules>
  7. <rule name="listinfo">
  8. <match url="^(.*/)*listinfo-(.+?)-(.+?).html\?*(.*)$" />
  9. <action type="Rewrite" url="{R:1}/e/action/ListInfo/index.php\?classid={R:2}&amp;page={R:3}" />
  10. </rule>
  11. <rule name="showinfo">
  12. <match url="^(.*/)*showinfo-(.+?)-(.+?)-(.+?).html\?*(.*)$" />
  13. <action type="Rewrite" url="{R:1}/e/action/ShowInfo.php\?classid={R:2}&amp;id={R:3}&amp;page={R:4}" />
  14. </rule>
  15. <rule name="infotype">
  16. <match url="^(.*/)*infotype-(.+?)-(.+?).html\?*(.*)$" />
  17. <action type="Rewrite" url="{R:1}/e/action/InfoType/index.php\?ttid={R:2}&amp;page={R:3}" />
  18. </rule>
  19. <rule name="tags">
  20. <match url="^(.*/)*tags-(.+?)-(.+?).html\?*(.*)$" />
  21. <action type="Rewrite" url="{R:1}/e/tags/index.php\?tagname={R:2}&amp;page={R:3}" />
  22. </rule>
  23. <rule name="comment">
  24. <match url="^(.*/)*comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?).html\?*(.*)$" />
  25. <action type="Rewrite" url="{R:1}/e/pl/index.php\?doaction={R:2}&amp;={R:3}&amp;={R:4}&amp;page={R:5}&amp;myorder={R:6}&amp;tempid={R:7}" />
  26. </rule>
  27. </rules>
  28. </rewrite>
  29. </system.webServer>  
  30. </configuration>

 

Nginx服务器

  1. rewrite ^([^\.]*)/listinfo-(.+?)-(.+?)\.html$ $1/e/action/ListInfo/index.php?classid=$2&page=$3 last;
  2. rewrite ^([^\.]*)/showinfo-(.+?)-(.+?)-(.+?)\.html$ $1/e/action/ShowInfo.php?classid=$2&id=$3&page=$4 last;
  3. rewrite ^([^\.]*)/infotype-(.+?)-(.+?)\.html$ $1/e/action/InfoType/index.php?ttid=$2&page=$3 last;
  4. rewrite ^([^\.]*)/tags-(.+?)-(.+?)\.html$ $1/e/tags/index.php?tagname=$2&page=$3 last;
  5. rewrite ^([^\.]*)/comment-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)-(.+?)\.html$  $1/e/pl/index\.php\?doaction=$2&classid=$3&id=$4&page=$5&myorder=$6&tempid=$7 last;
  6. if (!-e $request_filename) {
  7. return 404;
  8. }