Uni9K1ng 发表于 2016-2-6 09:03:31

rewrite的问题

#error_page   404   /404.html;

            #Custom rules Start
    rewrite ^/debs/([^/]+) /downloads.php?request=$1;
    rewrite ^/(Release)$ /lists.php?request=Release;
    rewrite ^/(Packages)$ /lists.php?request=Packages;
    rewrite ^/(Packages\.gz)$ /lists.php?request=Packages.gz;
    rewrite ^/(Packages\.bz2)$ /lists.php?request=Packages.bz2;
    rewrite ^/(rewritetest)$ /robots.txt;
    rewrite ^/view/(+)(.*) /index.php?method=view&pid=$1;
    rewrite ^/view/(+)/nohistory /index.php?method=view&pid=$1&addr=nohistory;
    rewrite ^/screenshot/(+)(.*) /index.php?method=screenshot&pid=$1;
    rewrite ^/history/(+)(.*) /index.php?method=history&pid=$1;
    rewrite ^/contact/(+)(.*) /index.php?method=contact&pid=$1;
    rewrite ^/section/(+)(.*) /index.php?method=section&pid=$1;
    rewrite ^/report/(+)/(+)(.*) /index.php?method=report&pid=$1&support=$2;
    rewrite ^/report/(+)(.*) /index.php?method=report&pid=$1;
    rewrite ^/more/(+)/(+)(.*) /index.php?method=more&pid=$1&offset=$2;
    rewrite ^/more/(+)(.*) /index.php?method=more&pid=$1;
    rewrite ^/more/(+)(.*) /index.php?method=more&pid=$1;
    rewrite ^/(misc)$ /misc.php;    #Custom rules End

      location ~ [^/]\.php(/|$)
      {
            # comment try_files $uri =404; to enable pathinfo
            try_files $uri =404;
            fastcgi_passunix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            #include pathinfo.conf;
      }


rewrite放这 怎么没有生效啊。0.0

licess 发表于 2016-2-6 19:20:21

放的位置没错,只要伪静态没问题,重启nginx就能生效

Uni9K1ng 发表于 2016-2-6 19:57:41

回复 2# 的帖子

我用include了,好了,谢谢
页: [1]
查看完整版本: rewrite的问题