Welcome! Log In Create A New Profile

Advanced

Re: URI re-mapping using try_files

October 11, 2012 03:59PM
Hi Francis,

Thanks for introducing me to rewrite directive. Just to confirm, this is how I should use your rewrite:

root /home/www/example;

location /public/doc/ {
rewrite (.*)/(.*) $1/$2/$2.html break;
}

Ideally, for the other cases you raised, I want the following to happen:

>http://www.example.com/public/doc/abc123
>http://www.example.com/public/doc/abc123?para=nodata

when the query string (e.g. ?para=blah) part is missing or incomplete, I want to serve a generic error page (e.g. /error.html)

>http://www.example.com/public/doc/abc123/abc123.html

when the user tries to access the actual html page directly, I want to block it by either returning a 404 or serving a generic error page as above

>http://www.example.com/public/doc/one/two

when the user queries an URI that has no corresponding .html file on the server, I want to simply return a 404.

Can all these be implemented using rewrite only? Thanks.
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: 69
Record Number of Users: 5 on July 11, 2016
Record Number of Guests: 271 on July 19, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready