永发信息网

nginx添加伪静态规则

答案:2  悬赏:80  手机版
解决时间 2021-04-05 23:43
  • 提问者网友:你给我的爱
  • 2021-04-05 04:48
比如 我程序用的是 这个规则
不知道怎么添加到 主机中
location / {
rewrite ^/vod-(.*)\.html$ /index.php?s=/Home-vod-$1 last;
rewrite ^/news-(.*)$ /index.php?s=/Home-news-$1 last;
rewrite ^special-(.*)$ /index.php?s=/Home-special-$1 last;
rewrite ^/tag-(.*)$ /index.php?s=/Home-tag-$1 last;
rewrite ^/gb-(.*)$ /index.php?s=/Home-gb-$1 last;
rewrite ^/cm-(.*)$ /index.php?s=/Home-cm-$1 last;
rewrite ^/map-(.*)$ /index.php?s=/Home-map-$1 last;
rewrite ^/my-(.*)$ /index.php?s=/Home-my-$1 last;
rewrite ^/Tpl/(.*)/Home/(.*).html$ /index.php last;
}
最佳答案
  • 五星知识达人网友:胯下狙击手
  • 2021-04-05 06:21
复制下来在你的配置文件中对应主机里加入就可,一般加入PHP配置的那段上面,但如果你有多个rewrite,那么他们之间是有顺序关系的
全部回答
  • 1楼网友:大漠
  • 2021-04-05 07:23
rewrite ^(.*)\.html$ /index.php/$1&args last; 注意要写到nginx.conf中去哈
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯