redirect to a .php file with try_files if required .php file not found

Francis Daly francis at daoine.org
Fri Mar 16 09:26:45 UTC 2018


On Thu, Mar 15, 2018 at 01:32:34PM +0200, ST wrote:

Hi there,

> maybe I pasted too much of my config, basically the important line is:
> 
>         try_files $uri /virtual_new.php =404;

The try_files documentation is at http://nginx.org/r/try_files

It is not clear to me what specific response you want, to a particular request.

I would expect that something like

  try_files $uri /virtual_new.php;

or

  try_files $uri @php_missing;

would be better; but it does depend on what you want.

So: if I request /not-there.php should I get a http 301 redirect to
/virtual_new.php, or should I get the http 200 response as if I had
requested /virtual_new.php, or should I get a http 404 response but with
content from /virtual_new.php, or should I get something else?

And: if I request /not-there.php/extra, what response should I get?

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list