|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2021-11-28 18:55 UTC] amenshchikov at gmail dot com
 Description:
------------
Instead of real request URI (without query string), that contained in REQUEST_URI env variable, "%r" outputs SCRIPT_NAME value into access log.
In case I need request URI with query string, I can use "%{REQUEST_URI}e" and there is no problem. But when I need request URI without query string (as it intended with "%r") I don't know what to do.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 04:00:01 2025 UTC | 
What I meant that we should update documentation to state that "%r" is for SCRIPT_NAME rather than for REQUEST_URI fcgi env. We cannot just change the value as it could potentially break some scripts that already depend on it being a SCRIPT_NAME. The thing is that internally script name is taken as request uri so I don't think REQUEST_URI is used for anything but might have missed something. In your case it doesn't really matter that much because if we just changed it to REQUEST_URI than it would contain a query so I guess it wouldn't help you. I guess specific flag for path info might help as it might not be always reliable to get it from env (at least the logic around that doesn't seem that straight forward as there are some hacks around Apache). You might actually give it a try and see if "%{PATH_INFO}e" or "%{ORIG_PATH_INFO}e" works for you?"%{PATH_INFO}e" produces empty string, "%{ORIG_PATH_INFO}e" produces "-". I have the following nginx configuration: server { ... location / { try_files $uri /index.php$is_args$args; } location ~ ^/index\.php(/|$) { fastcgi_pass unix:/run/php/php8.1-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi.conf; internal; } ... }