Welcome! Log In Create A New Profile

Advanced

map with preserving the URL

April 02, 2019 05:00AM
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
Subject Author Posted

map with preserving the URL

DieterK April 02, 2019 05:00AM

Re: map with preserving the URL

Francis Daly April 08, 2019 05:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 318
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready