2016-05-16 77 views
0

我一直无法得到这个答案。基本上,我有一堆网址,能像这样的:301重定向目录匹配

  • www.mysite.com/gb/best-price/description.shtml
  • www.mysite.com/fr/best-price/ description.shtml
  • www.mysite.com/jp/best-price/description.shtml

我需要他们被重定向到他们的直接匹配的网页,这是这样的:

  • www.mysite.c OM/GB /最佳价格/ index.shtml
  • www.mysite.com/fr/best-price/index.shtml
  • www.mysite.com/jp/best-price/index.shtml

我知道我可以做一对一的重定向,但事实是,我有数百个这样的网址......我如何获得重定向以匹配目标网址,而不需要进行1对1重定向, 1?例如,/gb/best-price/description.shtml到/gb/best-price/index.shtml

基本上,gb到gb,fr到fr,jp到jp。原始网址和新网址的唯一区别在于html文件名(原始文件以description.shtml结尾,新网址以index.shtml结尾)。

谢谢 亚历

回答

0

你可以尝试:

location/{ 
rewrite ^/(.*)/best-price/description.shtml ^//1/best-price/index.shtml permanent; 

我认为它可以帮助你。 !

+0

谢谢!让我试试看.. :) – lucidmist