首页  >  问答  >  正文

url-rewrite - Nginx 中rewrite url路径地址存在问题

系统中有一个需求是将某一段url链接地址转链到另外一段地址,model类似于将
localhost/wish/1234.jhtml自动转到localhost/community/detail/1234.jhtml。

目前Nginx我的配置写法是

location ~ ^/wish/$ {
rewrite ^/(.*)$  ^/community/detail/$1 permanent;
}

但是运行后系统提示404...请问我这句应该如何改呢?非常感谢!

巴扎黑巴扎黑2712 天前552

全部回复(1)我来回复

  • PHP中文网

    PHP中文网2017-05-16 17:28:14

    配置文件写错了,按下面的写就行,不用放在location下。
    rewrite ^/wish/(.*).jhtml$ /community/detail/.jhtml permanent;

    回复
    0
  • 取消回复