Welcome! Log In Create A New Profile

Advanced

Having trouble with the PCRE syntax

March 11, 2011 10:01AM
Hi,

would anybody please tell me what I'm doing wrong here?

location ~* ^/(forum|forums|board)/? {
     rewrite ^/([^/]*)/*(.*) http://forum.my_domain.com/$2 permanent;
}

I'd like to make it redirect visitors from http://www.my_domain.com/forum (note: there's no trailing slash), http://www.my_domain.com/forum/, http://www.my_domain.com/forums (again, there's no trailing slash here), http://www.my_domain.com/forums/, http://www.my_domain.com/board (...yep) and http://www.my_domain.com/board/ to http://forum.my_domain.com/. Neither the path (except "forum"/"forums"/"board") nor the query (if there's one) should get cut off. It's working so far, but it also redirects visitors from ex. http://www.my_domain.com/forumfoobar/, which isn't what I want. :-(

Thanks in advance!
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: 308
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