nginx通用重写规则

时间:2019-05-29 02:09:23

标签: php nginx

在这种情况下,我需要重写规则

0022024 0000004000000000000000000000000000000041   George Clan 00013
0052304 0000004000000000000000000000000000000041   John Teddy   000023

我想让我的网址看起来像

mydomain.com/?epunique=XXXX-XXXX-XX-XXXX-XX&epshare=fbtw&time=201905018

mydomain.com/XXXX-XXXX-XX-XXXX-XX/fbtw/201905018

XXX甚至可以是任何字符,甚至是文件名

mydomain.com/site/XXXX-XXXX-XX-XXXX-XX/fbtw/201905018

经过多次尝试,我得到了但不起作用

mydomain.com/account.php or mydomain.com/upload.php

这是我的Nginx版本

location = /site/(.+)/(.+)/(.+) {
   rewrite ^site/(.+)/(.+)/(.+)/?$ index.php?epunique=$1&epshare=$2&time=$3 last; 
}

更新05-29-2019

我部分工作了

nginx-1.12.2_11,2

但是现在服务器将错误消息发送到浏览器

location / {
            try_files $uri $uri.html $uri/ @extensionless-php;
                index index.html index.htm index.php;

                # reglas para urls limpias
                rewrite ^/(upload|upload_pago|desktopmap|upload_cat|refresh)/?$ /$1.php last;
                rewrite ^/(account|faq|planes|privacidad|nosotros)/?$ /$1.php last;
                rewrite ^/busca-por-mi/? /index.php?keywords=buscaxmi last;
                rewrite ^/empleos/? /index.php?category=empleo last;
                rewrite ^/buscar/(.+)/? /index.php?keywords=$1 last;
                rewrite ^/categoria/(.+)/? /index.php?category=$1 last;
                rewrite ^/subcategoria/(.+)/? /index.php?scategory=$1 last;
                rewrite ^/subsubcategoria/(.+)/? /index.php?sscategory=$1 last;
                rewrite ^/(.+)/(.+)/(.+)/?$ /index.php?epunique=$1&epshare=$2&ogpupd=$3 last;
                rewrite ^/(.+)/(.+)/?$ /index.php?epunique=$1&epshare=$2 last;
                rewrite ^/(.+)/?$ /index.php?epunique=$1 last;

        }
            location /(js|media|css|xajax)/{

            }

我在同一位置还有另一个js文件,但是只有这样才能失败,如果我评论了重写规则,则js和css文件将按预期工作

0 个答案:

没有答案