Welcome! Log In Create A New Profile

Advanced

Re: remove if from code

Reinis Rozitis
April 26, 2017 06:56AM
> Does anyone know how to rewrite this snippet?

> ## Execute PHP Scripts using FastCGI
> location ~ \.php(/.*)? {
> if (!-e $request_filename) {
> rewrite / /index.php last;
> }

You can use try_files for that (
http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files )

location ~ \.php$ {
try_files $uri /index.php;
}


p.s. obviously for this location you need to add php handling also.

rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

remove if from code

tommygunner April 25, 2017 04:16PM

Re: remove if from code

Reinis Rozitis April 26, 2017 06:56AM

Re: remove if from code

tommygunner April 26, 2017 01:09PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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