Welcome! Log In Create A New Profile

Advanced

Re: Having trouble with the PCRE syntax

Francis Daly
March 11, 2011 10:44AM
On Fri, Mar 11, 2011 at 10:01:03AM -0500, strike wrote:

Hi there,

> would anybody please tell me what I'm doing wrong here?
>
> location ~* ^/(forum|forums|board)/? {

You ask for /, forum, then one-or-no slash.

> It's working so far, but it also redirects
> visitors from ex. http://www.my_domain.com/forumfoobar/, which isn't
> what I want. :-(

The second "f" in "forumfoobar" is one-or-no slash. (Specifically,
it is no slash). So it matches.

You want to ask for /, forum, then either a slash or end-of-string.

location ~* ^/(forum|forums|board)(/|$) {

(You could also abbreviate forum|forums to forums?, should you so choose.)

Good luck,

f
--
Francis Daly francis@daoine.org

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

Having trouble with the PCRE syntax

strike March 11, 2011 10:01AM

Re: Having trouble with the PCRE syntax

Sven 'Darkman' Michels March 11, 2011 10:14AM

Re: Having trouble with the PCRE syntax

strike March 11, 2011 10:25AM

Re: Having trouble with the PCRE syntax

Francis Daly March 11, 2011 10:44AM

Re: Having trouble with the PCRE syntax

Francis Daly March 11, 2011 10:52AM

Re: Having trouble with the PCRE syntax

Maxim Dounin March 11, 2011 12:36PM

Re: Having trouble with the PCRE syntax

Igor Sysoev March 11, 2011 12:50PM

Re: Having trouble with the PCRE syntax

strike March 11, 2011 03:39PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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