[日常] 前端资源测试机上忽略版本号的的nginx配置
2024-08-31 20:36:48
利用nginx的rewrite的指令,可以实现url的重新跳转,rewrtie有四种不同的flag,分别是redirect(临时重定向)、permanent(永久重定向)、break和last。其中前两种是跳转型的flag,后两种是代理型,跳转型是指有客户端浏览器重新对新地址进行请求,代理型是在WEB服务器内部实现跳转的
redirect #临时重定向,重写完成后以临时重定向方式直接返回重写后生成的新URL给客户端,有客户端重新发起请求,使用相对路径,http://或https://开头,状态码:302
permanent #永久重定向,以永久重定向的方式直接返回重写后生成的新URL给客户端,由客户端重新发起新的请求,状态码:301
last #重写完成后停止对当前location中后续的其他重写操作,而后对新的URL启动新一轮重写检查,不建议在location中使用
break #重写完成后停止对当前URL在当前location中后续的其他重写操作,而后直接跳转至重写规则匹配块之后的其他配置;结束循环,建议在location中使用
server {
listen ;
server_name n.sinaimg.cn 2008mail.sina.com.cn www.sinaimg.cn ; root /usr/local/sinaria;
rewrite ^/mail/sinamail66/js/\d+/(.*)$ /sinamail66/js/$ last;
rewrite ^/mail/sinamail66/css/\d+/(.*)$ /sinamail66/css/$ last;
rewrite ^/mail/sinamail66/images/\d+/(.*)$ /images/$ last;
rewrite ^/mail/sinamail66/skins/\d+/(.*)$ /skins/$ last;
rewrite ^/mail/sinamail/js/\d+/(.*)$ /mail/$ last;
rewrite ^/rny/webface/conf/\d+/(.*)$ /webface/conf/$ last;
rewrite ^/rny/sinamail66/skins/\d+/(.*)$ /sinamail66/skins/min/$ last;
rewrite ^/rny/sinamail57/images/\d+/(.*)$ /images/$ last;
rewrite ^/js/(.*)$ /js/$ last;
location / {
} }
最新文章
- CSS float
- Redis集群~StackExchange.redis连接Twemproxy代理服务器
- Flask最佳实践
- 【转】C++怎么读写windows剪贴板的内容?比如说自动把一个字符串复制.
- Hololens开发笔记之Gesture手势识别(单击,双击)
- PHP的日期和时间
- 比支付宝更好用的读IC卡信息工具
- 如何在mysql中退出当前窗口界面而不关闭窗口的方法
- 生产者与消费者(三)---BlockingQueue
- psql rank row
- swift中的&;-备
- 调用WCF的异步方法
- PHP编程效率的20个要点--PHP技术教程分享
- 速度之王 — LZ4压缩算法(二)
- Docker镜像管理基础与基于容器的镜像制作示例
- [20171120]11G关闭直接路径读.txt
- iOS开发-- 使用TFHpple解析html
- tensoflow模型中提示:ValueError: Variable rnn/basic_rnn_cell/kernel already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? 解决办法
- cxGrid之checkbox小结
- 团队作业8——测试与发布(Beta阶段)目录
热门文章
- ABP入门教程15 - 小结
- ubuntu 桌面版, ssh 连接时使用,x转发进行使用 gnome-terminal 时出现:Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached 错误
- PHP的stdClass
- Day7 - Python基础7 面向对象
- 【Oracle】SQL的一些关键字
- Rust v1.39发布 - 这个编程语言真不一般!
- 使用adb安装apk到手机
- cartographer 3D scan matching 理解
- 如何查看PDF的坐标
- centos安装mongodb 4.x及配置用户名密码(官方推荐的方式)