伪静态 NGINX =>  ISAPI_Rewrite

lrenwang , 2015/04/25 20:39 , Linux , 评论(0) , 阅读(1550) , Via 本站原创 | |
nginx

  rewrite ^/search/(.*?) /index.php?do=search&k=$1 last;
  rewrite ^/([a-zA-Z0-9A-Z0-9]+).html$ /?do=single&alias=$1;
  rewrite ^/([a-zA-Z0-9]+)/$ /?do=news_list&alias=$1;
  rewrite ^/([a-zA-Z0-9]+)/([0-9]+)$ /?do=news_list&alias=$1&page=$2;
  rewrite ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/$ /?do=news_list&alias=$2&tpl=$1;

  rewrite ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([0-9]+)$ /?do=news_list&alias=$2&page=$3&tpl=$1;
  rewrite ^/([a-zA-Z0-9]+)/([0-9]+).html$ /?do=news_detail&id=$2&alias=$1;

  rewrite ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([0-9]+).html$ /?do=news_detail&tpl=$1&id=$3&alias=$2;
  rewrite ^/sitemap.xml$ /index.php?do=sitemap;



ISAPI_Rewrite

RegistrationName= wlqcwin
RegistrationCode= 2EAD-35GH-66NN-ZYBA

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32

#默认包含了301设置,此设置情况下cctv.com/aa.htm 会301跳至www.cctv.com/aa.htm,将cctv.com替换为您自己的域名就能实现自己的域名的301
#RewriteCond %{HTTP:Host} ^zwgs.com$
#RewriteRule (.*) http://www.zwgs.com$1 [NC,R=301]

RewriteRule ^/([a-zA-Z0-9A-Z0-9]+).html$ /index.php?do=single&alias=$1 [L]
RewriteRule ^/([a-zA-Z0-9]+)/$ /index.php?do=news_list&alias=$1 [L]
RewriteRule ^/([a-zA-Z0-9]+)/([0-9]+)$ /index.php?do=news_list&alias=$1&page=$2 [L]
RewriteRule ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/$ /index.php?do=news_list&alias=$2&tpl=$1 [L]

RewriteRule ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([0-9]+)$ /index.php?do=news_list&alias=$2&page=$3&tpl=$1 [L]
RewriteRule ^/([a-zA-Z0-9]+)/([0-9]+).html$  /index.php?do=news_detail&id=$2&alias=$1 [L]

RewriteRule ^/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([0-9]+).html$ /index.php?do=news_detail&tpl=$1&id=$3&alias=$2 [L]

发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]