Welcome! Log In Create A New Profile

Advanced

Re: Rewrite rule and the try_files directive

Edho Arief
May 25, 2012 09:02AM
On Fri, May 25, 2012 at 7:01 PM, Captain_Quor <nginx-forum@nginx.us> wrote:
> Hi guys,
>
> I'm a little stuck here and wondered if anyone could help, I have a
> customer's website with the following rewrite rule:
>
> 'rewrite ^/(.*)$ /index.php?town=$1 last;'
>
> This has functioned just fine until they've added three smaller
> management sites that they want to be able to reach by appending either
> /mms, /admin or /newsletter to the end of the URL (I have tried to steer
> them towards subdomains but to no avail!) now these are obviously being
> picked up by my rewrite rule and as the website doesn't recognise these
> as "towns" it's simply redirecting them back to the home page.
>
> Does anyone know a clean way of achieving this, I was originally looking
> at an 'if' statement but I've been warned off this when it comes to
> nginx due to the obvious reasons, I've been looking in to the try_files
> directive but I'm still a little unsure as to how it actually works.
>

location /admin/ {
...
}
location /mms/ {
...
}
location /newsletter/ {
...
}
location / {
rewrite ...
}

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

Rewrite rule and the try_files directive

Captain_Quor May 23, 2012 10:39AM

Re: Rewrite rule and the try_files directive

Edho Arief May 25, 2012 09:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 228
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