Hi,
When I try to use rewrite to replace try_files, my php application
report
error. Finally I find $_SERVER[“PATH_INFO”] is different between
try_files
and rewrite.
nginx/1.4.4
PHP 5.4.22
try_files:
try_files $uri $uri/ /index.php$request_uri;
url: http://example.com/a/b/c?d=1 , $_SERVER[“PATH_INFO”] is /a/b/c
but, when I use rewrite:
if ( $host = "example.com" ) {
set $example 1$example;
}
if ( $uri !~ \.(ico|gif|png|jpeg|css|js|xml|html|shtml|swf|mp3)
) {
set $example 11$example;
}
if ( $example = 111 ) {
rewrite ^ /index.php$request_uri last;
}
url: http://example.com/a/b/c?d=1 , $_SERVER[“PATH_INFO”] is /a/b/c?d=1
Obviously try_files is right , I can use $uri in rewrite to solve this
problem.
My question is why $request_uri in try_files and rewrite but get
different
$_SERVER[“PATH_INFO”] ?
thanks!