Mobile app version of vmapp.org
Login or Join
Bryan171

: Nginx request map and redirect have no effect I want to rewrite/return request to new one I have: map map $request $new_request { include url_rmap.conf; } file url_rmap.conf # here

@Bryan171

Posted in: #Nginx #Redirects #UrlRewriting

I want to rewrite/return request to new one

I have:


map

map $request $new_request {
include url_rmap.conf;
}

file url_rmap.conf

# here i have tried all variations
$scheme://d.dom any.other/address $scheme://d.dom/ any.other/address https://d.dom any.other/address https://d.dom/ any.other/address
server block

server {

listen ip:port;
server_name a.dom b.dom aa.a.dom w.c.dom d.dom;

# first try
if($new_request) {
return 301 $new_request;
}

# also second with @redirect -nap
location / {
# Support Clean (aka Search Engine Friendly) URLs
try_files @redirect -map $uri $uri/ /index.php?$args;
}

location @redirect -map {
if ($new_request) { # redirect if the variable is defined
return 301 $new_request;
}
}

}



both ways with to call d.dom fail to redirect and have no effect. why?

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme