douzachan4578 2018-07-05 19:21
浏览 71

nginx php urls路径使用文件

hope somebody can help me, Im trying to force nginx config to show specific files when the a url is reached, example:

/contact uses contact.php

/shop?something=x uses shop.php

/shop/xxxxx uses category.php

/shop/sale/xxxx?something=x uses product.php

/tienda/xxxxx uses categoria.php

Appreciate any help

  • 写回答

1条回答

  • douwuli4512 2018-07-05 20:08
    关注

    /shop/xxxxx uses category.php:

    rewrite ^/shop/(.*)$ /category.php?category=$1 last;
    

    Check out NGINX rewriting: https://www.nginx.com/blog/creating-nginx-rewrite-rules/

    As well, you can check out: https://www.thegeekstuff.com/2017/08/nginx-rewrite-examples/

    I would highly recommend using some sort of framework. URL rewriting can become very hard to maintain really quickly.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!