Welcome! Log In Create A New Profile

Advanced

Re: Having trouble with the PCRE syntax

March 11, 2011 12:50PM
On Mar 11, 2011, at 20:33 , Maxim Dounin wrote:

> Correct regexp-based solution would be
>
> location ~* ^/(?:forum|forums|board)(?:/|$) {
> rewrite ^/[^/]*/*(.*) http://forum.my_domain.com/$2 permanent;
> }
>
> But recommended way is to avoid regexp-based solutions without
> real need. It's much simplier and much more scalable to write
> configuration with normal static locations, i.e.
>
> location = /forum {
> rewrite ^ http://forum.my_domain.com/ permanent;
> }
> location /forum/ {
> rewrite ^/forum/(.*) http://forum.my_domain.com/$1 permanent;
> }
> location = /board {
> rewrite ^ http://forum.my_domain.com/ permanent;
> }
> location /board/ {
> rewrite ^/board/(.*) http://forum.my_domain.com/$1 permanent;
> }
>
> This way you'll save yourself a headache.

[ when configuration will eventually grow.
And it will certainly grow eventually. ]

> As a side effect - it's
> faster.
>
> Maxim Dounin


--
Igor Sysoev
http://sysoev.ru/en/


_______________________________________________
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: 77
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