My current configuration rewrites all php pages to /index.php?$query_string
, I need this to work for a specific path, but when using a location block for this, once the path has been rewritten it no longer matches. Is there a way to to forward a request to fpm and rewrite the URI in same location block without redirecting? Or an alternative that will accomplish what I want?
Here is my specific code:
location /civicrm/group {
location ~ \.php$ {
fastcgi_send_timeout 0;
fastcgi_read_timeout 0;
include snippets/fastcgi-common.conf;
fastcgi_param HTTPS 'on';
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
try_files $uri @drupal;
}
location ~ \.php$ {
include snippets/fastcgi-modify.conf;
include snippets/fastcgi-common.conf;
fastcgi_param HTTPS 'on';
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location @drupal {
try_files $uri /index.php?$query_string;
}
The problem is this means I lose information on the original base path and can no longer match the original location, for example:
- Request
/civicrm/group?reset=1
- Match location
/some/path
, this is where I would like to change the settings forphp-fpm
. - I need to change the URI, so I rewrite to
/index.php?$query_string
- Now, I start matching from the beginning, but now the location
/some/path?reset=1
wont match (problem) - So I match the regular php location block.