Forum Topic

Thanks for your participation and contribution.


Back to NGINX

Rewrite Query Parameters as part of path

Post a reply
328 views
i90runner
i90runner

Rewrite Query Parameters as part of path

https://serverfault.com/questions/488444/nginx-rewrite-convert-querystring-to-path


location ~ /extended_lca_data.php {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;

if ($args ~* "^LCADataID=(\d+)") {
set $id $1;
set $args '';
rewrite ^.*$ $scheme://$host/lca/detail/$id permanent;
}
}

location ~ ^/lca/detail? {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;

if ($args ~* "^LCADataID=(\d+)") {
set $id $1;
set $args '';
rewrite ^.*$ $scheme://$host/lca/detail/$id permanent;
}
}

Last updated

1-1 of 1

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.