map with preserving the URL
DieterK
nginx-forum at forum.nginx.org
Tue Apr 2 09:00:19 UTC 2019
Hello,
I'm trying to make the URLs on my site more "friendly" with map, but I don't
understand the right way.
My config looks like this:
=========
map $uri_lowercase $new {
include /foobar/rewriterules.map;
}
server {
listen 443 ssl;
[...]
location / {
if ($new) {
rewrite ^ $new redirect;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/foobar;
include global/php.conf;
}
}
The rewriterules.map looks like this:
/product/foo /product.php?id=100;
/product/bar /product.php?id=200;
This also works so far, but I want to preserve the URL in the address bar.
I already tried it with break instead of redirect, unfortunately it doesn't
seem to work. (error 500)
What's the right way to do this?
Thanks
Dieter
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,283588,283588#msg-283588
More information about the nginx
mailing list