zoukankan      html  css  js  c++  java
  • textpattern 在 nginx 上的 rewrite 规则

        Clean URLs for Textpattern with Nginx

    最近又开始折腾 textpattern  ,由于我的 web 环境是基于 nginx ,在网上搜索了下 textpattern 在 nginx 上的 rewrite 规则,找到一个最完美的,

         适用 textpattern 的各种链接形式 

    Reference Address:

    http://motionobj.com/blog/textpattern-on-nginx-rewrite-rule

    代码如下

         location /  
         { root /var/www/where-document-root-is/; index index.html index.htm index.php; 
         if (!-e $request_filename) { rewrite ^(.*) /index.php; } } 
        另外提供几个非完美的
         if (-e $request_filename) { break; } rewrite ^/(.*)$ /index.php?=$1 last; 
         --------------- 
        rewrite ^(.*)/category/(.*)/$ $1/index.php?c=$2 last;#
     rewrite ^(.*)/category/(.*)$ $1/index.php?c=$2 last;
     rewrite ^(.*)/rss/$ $1/index.php?rss=1 last;
     rewrite ^(.*)/atom/$ $1/index.php?atom=1 last; 
    rewrite ^(.*)/tag/(.*)/$ $1/index.php?s=tag&t=$2 last;#
     rewrite ^(.*)/tag/(.*)$ $1/index.php?s=tag&t=$2 last;
     rewrite ^(.*)/(\d*)(/.*)$ $1/index.php?id=$2 last; 
    rewrite ^(.*)/(.*)/$ $1/index.php?s=$2 last; 
    rewrite ^(.*)/(.*)$ $1/index.php?s=$2 last; 
         ----------------- 
         最上面的是最完美解决方案, 
         下面两种只支持某个特定格式,具体如果从代码上看不出来,您可以直接尝试一下就知道了。 

    __EOF__

    Be Sociable, Share!
  • 相关阅读:
    ORACLE(系统表emp) 基本与深入学习
    jQuery框架 的四个入口函数
    函数
    sql1999语法
    左连接,右连接
    Oracle单行函数用法
    Kettle
    order by 排序
    sql*plus
    sql基本语句
  • 原文地址:https://www.cnblogs.com/shihao/p/2616208.html
Copyright © 2011-2022 走看看