首页 > Nginx 中rewrite url路径地址存在问题

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

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

目前Nginx我的配置写法是

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

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


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

【热门文章】
【热门文章】