Redirect nginx中的301重定向

Redirect nginx中的301重定向,redirect,nginx,nginx-location,Redirect,Nginx,Nginx Location,我试图在nginx中将一个url从一个域重定向到另一个域 URL 1-http://domain1/event/ert123 URL 2-http://domain2/event/dfe456 我使用了下面的代码,但不起作用 #Test event location /event/ert123 { return 301 http://domain2.com/$request_uri } 非常感谢您的帮助。提前感谢。为什么$request\u uri?也许是这样

我试图在nginx中将一个url从一个域重定向到另一个域

URL 1-http://domain1/event/ert123

URL 2-http://domain2/event/dfe456

我使用了下面的代码,但不起作用

   #Test event
   location /event/ert123 {
        return 301 http://domain2.com/$request_uri
   }

非常感谢您的帮助。提前感谢。

为什么
$request\u uri
?也许是这样的

  location /event/ert123 {
        return 301 http://domain2.com/event/dfe456
   }

什么不起作用?起作用了,非常感谢。