I am having some issues getting the below to work the way I expect. What I am trying to do is take a url like


but have it sent to php with the URI like


It just seems to keep giving me 404's.

location ~ ^(?P<one>.*)/(?P<two>details|scheduler)/(?P<three>.*)$ {
    try_files $uri $uri/ /index.php?/product/$two/$three&original_path=$one;

location ~* \.php$ {
    fastcgi_index index.php;
    fastcgi_param SCRIPT_URL $my_script_url;
    fastcgi_param SCRIPT_URI $scheme://$http_host$my_script_url;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PHP_SELF $uri;
    fastcgi_param HTTPS $https if_not_empty;
    fastcgi_param HTTP_FRONT_END_HTTPS HTTPS;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param REQUEST_URI $uri?$args;
    include fastcgi_params;
    fastcgi_ignore_headers "Cache-Control";
    fastcgi_ignore_headers "Expires";
    fastcgi_ignore_headers "Set-Cookie";

What is strange is that I can put the URL in like


and it works fine.

Something else that seems strange to me is that if I implement the php-fpm status page each request, via the try_files above or entering the URL manually shows the same script and request_uri, but only the manually entry is working how I would expect.

  • That second ? is unusual - usually & is used to join elements of a query string. I wonder if encountering two ?s is confusing try_files. Jan 22, 2016 at 18:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.