2012-05-20 21 views
1

我試圖重定向從: http://domain.com/public/photos/large/test.jpg 到: http://domain.com/images/public/photos/large/test.jpg 在NGINX環境。如何在NGINX環境中重定向網址?

我的虛擬主機文件配置像下一行。 我的問題是,像這樣的語法不工作:

server { 
     ........ 
     rewrite ^(public/photos/(.*)) http://domain.com/images/$1 last; 
     location/{ 
      location ~.*\.(3gp|jpg|jpeg|gif)$ { 
       expires 7d; 
       try_files $uri @backend; 
      } 
     } 
     .......... 
} 

的重寫規則語法是在的.htaccess環境測試,現在工作了2年多。在nginx上它不再有了。

任何想法? 10X

回答

0

試試這個:

rewrite ^/public/photos/(.*)$ http://domain.com/images/public/photos/$1 last; 
+0

謝謝你的回覆。沒有運氣。我修改了它,然後重新啓動了NGINX和http服務。 –