wecenter伪静态规则分享


# nginx configuration
 
error_page 404 /404.php;
 
location / {
  rewrite ^/(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.php;
  rewrite ^/(.*)/(admin|cache|editor|file|include|lang|module|skin|template)/(.*)\.php(.*)$ /404.php;
  rewrite ^/(.*)/([0-9]+)([\-])?([0-9]+)?\.html$ /$1/show.php?itemid=$2&page=$4;
  if (!-e $request_filename){
    rewrite ^/([a-z0-9]+)/$ /zone.php?zonedir=$1;
  }
  if (!-e $request_filename){
    rewrite ^/(.*)/([A-za-z0-9]+)/([A-za-z0-9]+)/$ /$1/list.php?catdir=$3&areadir=$2;
  }
  if (!-e $request_filename){
    rewrite ^/(.*)/([A-za-z0-9]+)/$ /$1/list.php?catdir=$2;
  }
  rewrite ^/([a-z0-9]+)\.html$ /index.php?homepage=$1;
  rewrite ^/([a-z0-9_\-]+)-([a-z]+)/(.*)\.html$ /index.php?homepage=$1&file=$2&rewrite=$3;
  rewrite ^/([a-z0-9_\-]+)-([a-z]+)\.html$ /index.php?homepage=$1&file=$2;
  rewrite ^/(.*)/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /$1/index.php?moduleid=$2&catid=$3&itemid=$4&page=$5;
}
 
location /about {
  rewrite ^/about-([A-za-z0-9]+).html$ /about/index.php?itemid=$1;
}
 
location = /city.html {
  rewrite ^(.*)$ /api/city.php break;
}
 
location /city {
  rewrite ^/city-([A-za-z0-9]+).html$ /api/city.php?cat=$1;
}
 
location = /allcate.html {
  rewrite ^(.*)$ /allcate.php break;
}
 
location = /post {
  rewrite ^(.*)$ /post.php;
}
 
-------------------------------------------------------------------------------------------------------------------------------
# nginx configuration
 
error_page 404 /404.php;
 
location / {
if (!-e $request_filename)
{
rewrite (.*) /index.php;
}
}
 
location /about {
  rewrite ^/about-([A-za-z0-9]+).html$ /about/index.php?itemid=$1;
}
 
location = /city.html {
  rewrite ^(.*)$ /api/city.php break;
}
 
location /city {
  rewrite ^/city-([A-za-z0-9]+).html$ /api/city.php?cat=$1;
}
 
location = /allcate.html {
  rewrite ^(.*)$ /allcate.php break;
}
 
location = /post {
  rewrite ^(.*)$ /post.php;
}
 
location /post {
  rewrite ^/post([\-])?a([0-9]+)([\-])?c([0-9]+)([\-])?m([0-9]+)?\.html$ /post.php?cityid=$2&cate=$4&mid=$6;
}
 
location /tag {
  rewrite ^/tag/([A-za-z0-9]+)/$ /tag/tag.php?tagdir=$1;
}
 
location /telinfo {
  rewrite ^/telinfo-([A-za-z0-9]+).html$ /telinfo.php?tel=$1;
}
location ~* \.tpl.htm{
     deny all;
}
 
location /post {
  rewrite ^/post([\-])?a([0-9]+)([\-])?c([0-9]+)([\-])?m([0-9]+)?\.html$ /post.php?cityid=$2&cate=$4&mid=$6;
}
 
location /tag {
  rewrite ^/tag/([A-za-z0-9]+)/$ /tag/tag.php?tagdir=$1;
}
 
location /telinfo {
  rewrite ^/telinfo-([A-za-z0-9]+).html$ /telinfo.php?tel=$1;
}
location ~* \.tpl.htm{
     deny all;
}


3 个评论

如果大家喜欢的话,麻烦收藏一下就可以了,在这里就不进行特别赘述
喜欢的请收藏,确实很实用
这个确实有点意思

要评论文章请先 注册