Welcome! Log In Create A New Profile

Advanced

Re: URI re-mapping using try_files

Francis Daly
October 11, 2012 06:14PM
On Thu, Oct 11, 2012 at 05:22:54PM -0400, mrtn wrote:

Hi there,

> >I guess (without testing):
> >
> >if ($arg_para != data) { return 404; }
> >
> >inside that location{} would probably work
>
> Hmm, I read on nginx website and elsewhere that if statement may not work
> consistently within a location directive, and is generally discouraged.
> Should I worry in this case?

What precisely did you read? And does it apply here?

(I think I know the answers to those; but there's no reason for you to
believe my words instead of words written elsewhere. If the words are
all consistent, then you can choose to believe them all. If the words are
contradictory, then you must choose which source to consider incorrect.)

> >(As in: do you repeat everything after /public/doc, or do you repeat
> >just the final after-slash part?)
>
> I only want to repeat the final after-slash part, so any
> '/public/doc/blahA/blahB' should only look for
> '/public/doc/blahA/blahB/blahB.html'. Would that change anything in the
> config proposed here?

What happened when you tried it?

mkdir -p /home/www/example/public/doc/blahA/blahB/blahA
echo This is in blahB > /home/www/example/public/doc/blahA/blahB/blahB.html
echo This is in blahA > /home/www/example/public/doc/blahA/blahB/blahA/blahB.html
curl -i http://www.example.com/public/doc/blahA/blahB

As it happens, the rewrite suggested should end up fetching the "in blahB"
file, because it only repeats the part after the last slash.

When you understand *why* it does that, you'll have a better chance of
writing your own regex-based rewrites.

Good luck with it!

f
--
Francis Daly francis@daoine.org

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

URI re-mapping using try_files

mrtn October 11, 2012 09:19AM

Re: URI re-mapping using try_files

Francis Daly October 11, 2012 12:58PM

Re: URI re-mapping using try_files

mrtn October 11, 2012 03:59PM

Re: URI re-mapping using try_files

Francis Daly October 11, 2012 04:34PM

Re: URI re-mapping using try_files

mrtn October 11, 2012 05:22PM

Re: URI re-mapping using try_files

Francis Daly October 11, 2012 06:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready