2

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 https://any.other/address
    $scheme://d.dom/ https://any.other/address
    https://d.dom https://any.other/address
    https://d.dom/ https://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 https://d.dom fail to redirect and have no effect. why?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.