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

ST smntov at gmail.com
Sun Mar 18 09:39:47 UTC 2018


Thank you for the detailed clarification!


On Fri, 2018-03-16 at 09:26 +0000, Francis Daly wrote:
> 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



More information about the nginx mailing list