Welcome! Log In Create A New Profile

Advanced

URI re-mapping using try_files

October 11, 2012 09:19AM
Hello,

I am new to nginx, and am still learning my way.

I use nginx to serve static html pages to users, and in particular, I want users who visit 'www.example.com/public/doc/abc123?para=data' to be served with the file '/home/www/example/public/doc/abc123/abc123.html' on the server, but 'www.example.com/public/doc/abc123?para=data' stays in the user's browser address bar.

So there are two issues here: 1. map URI pattern '/public/doc/blah' to file '/home/www/example/public/doc/blah/blah.html' on the server; 2. keep query string '?parap=data' in the address bar.

I wonder if these can be solved by using `try_files` within a location block. For example, substring the $uri to take out '/blah' part, and append it to the $uri followed by '.html'. And possibly append $args after '.html'? How exactly do we do this in nginx? 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: 114
Record Number of Users: 6 on August 08, 2016
Record Number of Guests: 386 on August 02, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready