How to write a url rewrite in nginx?

前端 未结 2 1191
北恋
北恋 2020-11-28 06:13

I want people type in http://www.myweb.com/like/1234456 will redirect to http://www.myweb.com/item.php?itemid=1234456

I wrote something like this in the config but

2条回答
  •  遥遥无期
    2020-11-28 06:42

    Try this,

    server {
      server_name www.myweb.com;
      rewrite ^/like/(.*) http://www.myweb.com/item.php?itemid=$1 permanent;
    }
    

提交回复
热议问题