Welcome! Log In Create A New Profile

Advanced

Re: Route non-existant .php requests through try_files?

June 15, 2012 11:58PM
Thanks for your reply. Adding the try_files setting into the PHP location block made it behave as expected

Thanks! :)

Francis Daly Wrote:
-------------------------------------------------------
> On Thu, Jun 14, 2012 at 11:24:12PM -0400, Daniel15
> wrote:
>
> Hi there,
>
> > location / {
>
> > location /assets/cache/ {
>
> > location ~ \.php$ {
>
> > However if I go to a non-existent PHP file (like
> > example.com/about.php), I get a white page that
> says "File not found."
> > There's some legacy links that have ".php" at
> the end and routing these
> > to the correct location is handled in the app
> itself. Because of my
> > try_files setting, I expected this to go through
> index.php,
>
> No.
>
> One request is handled by one location. The
> request for /about.php
> will be handled by the "php" regex location, which
> doesn't (currently)
> include try_files.
>
> http://nginx.org/r/location
>
> Untested, but probably either:
>
> copy the try_files line into the "php" regex
> location; or
>
> move the "php" regex location to be within the
> "location /" block
>
> should do what you want in most cases.
>
> ("most" because: what do you want to happen when
> the request is for
> "/assets/cache/absent.php", or for
> "/assets/cache/present.php"? The two
> options above will do different things.)
>
> 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

Route non-existant .php requests through try_files?

Daniel15 June 14, 2012 11:24PM

Re: Route non-existant .php requests through try_files?

Francis Daly June 15, 2012 03:56AM

Re: Route non-existant .php requests through try_files?

Daniel15 June 15, 2012 11:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
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