Welcome! Log In Create A New Profile

Advanced

Re: Query Rewrite Help

Ben
July 13, 2015 09:40AM
Thanks !

On 13/07/2015 12:04, B.R. wrote:
> Your PCRE is not right. You might interpret it in more 'natural'
> language as:
> <start>/api/app/<anything but '/'>/<anything but '/'>/<anything but '/'
> or nothing><end>
> The URI /api/app/login does not match it.
>
> You have several ways of addressing that:
> - Rewrite you huge, do-it-all PCRE, adding optional, non-capturing groups
> - Split the rewriting rule in several versions, each addressing one
> depth level (eases readibility/maintenance/performance?)
>
> I would also suggest you avoid using rewrite and replace it with
> location/return as much as you could:
> https://youtu.be/YWRYbLKsS0I
> ---
> *B. R.*
>
> On Mon, Jul 13, 2015 at 12:17 PM, Ben <ben+nginx@list-subs.com
> <mailto:ben+nginx@list-subs.com>> wrote:
>
> Hi,
>
> Am suffering with a bit of writer's block when it comes to query
> rewrites.
>
> I've got a rewrite rule that looks like :
>
> rewrite ^/api/app/([^/]+)/([^/]+)/([^/]+)?$
> /api/app/$1.php?p=$2&q=$3? last;
>
> I am having two problems :
>
> - I am getting 404 when I try to make a POST call to
> /api/app/login, I have to use the full suffix, i.e.
> api/app/login.php instead.
>
> - I want to make the last ([^/]+) optional, but seem to also be
> getting the same 404 if I forget to include it ?
>
> Ideas most welcome, thanks !
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org <mailto:nginx@nginx.org>
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Query Rewrite Help

Ben July 13, 2015 06:18AM

Re: Query Rewrite Help

B.R. July 13, 2015 07:06AM

Re: Query Rewrite Help

Ben July 13, 2015 09:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready