I have Nginx setup with a try_files statement:
location / {
try_files $uri $uri/ @php;
}
location @php {
rewrite ^/(.*)$ /index.php?$1 last;
}
So www.example.com/thisfolder
is handled by my index.php with a $_GET['thisfolder']
, upon which PHP can act. This works fine.
However, the path in the URL can contain spaces like so: www.example.com/this folder
.
In that case I get a $_GET['this_folder']
(with an underscore), instead of the $_GET['this folder']
that I expected.
Encoding the URL as www.example.com/this%20folder
does not change anything. Is the space-to-underscore-replacement done by PHP or by Nginx and how do I get rid of it so PHP gets the parameter with a space in the name?