Welcome! Log In Create A New Profile

Advanced

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

ST
March 15, 2018 07:34AM
PS:

maybe I pasted too much of my config, basically the important line is:

try_files $uri /virtual_new.php =404;

Does it look legitim to you? Is it the proper way to redirect in such a
case or should I better use rewrite/redirect?

Thank you!

-------------------------------------------

Hello,

I would like to redirect to /virtual_new.php with try_files if
required .php file not found, is it the right way to do so:

location ~ \.php$ {

if ($args ~ "netcat_files/") {
expires 7d;
add_header Cache-Control "public";
}

fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri /virtual_new.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root
$fastcgi_script_name;
include fastcgi_params;
}

Thank you!


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

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

ST March 15, 2018 07:34AM

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

Francis Daly March 16, 2018 05:28AM

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

ST March 18, 2018 05:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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