Having trouble with the PCRE syntax

strike nginx-forum at nginx.us
Fri Mar 11 18:25:48 MSK 2011


Thanks for your reply! But http://www.my_domain.com/forumfoobar/ still
redirects to http://forum.my_domain.com/. I don't want that. :-(

Sven 'Darkman' Michels Wrote:
-------------------------------------------------------
> Hi,
> 
> i'd write the end more like (/?|$), this would
> match if there
> is a /, or if there is the end - i think.
> 
> Regards,
> Sven
> 
> Am 11.03.2011 16:01, schrieb strike:
> > 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!
> > 
> > Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,182278,182278#ms
> g-182278
> > 
> > 
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,182278,182284#msg-182284




More information about the nginx mailing list