Welcome! Log In Create A New Profile

Advanced

Rewrite rule and the try_files directive

May 23, 2012 10:39AM
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.

Any help greatly appreciated.

Thanks,

Andy
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: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready