Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

$request_uri in rewrite and try_files (no replies)

$
0
0
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!
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>