当前位置: 首页 > news >正文

在哪里申请域名短视频seo营销系统

在哪里申请域名,短视频seo营销系统,上海购物网站建设,北京高端网站制作Nginx 的 rewrite 指令用于根据正则表达式来匹配请求的 URI,并将其重写为新的 URI。rewrite 指令可以包含一个可选的 flag(标志),该标志用于控制重写操作后的行为。 rewrite regex replacement [flag] 一. 常用四种 flag redir…

Nginx 的 rewrite 指令用于根据正则表达式来匹配请求的 URI,并将其重写为新的 URI。rewrite 指令可以包含一个可选的 flag(标志),该标志用于控制重写操作后的行为。

rewrite regex replacement [flag]

一. 常用四种 flag

  1. redirect(302 临时重定向)
  • 当重写完成后,以临时重定向的方式返回重写后生成的新 URL给客户端,状态码为 302。
  • 浏览器地址栏会显示跳转后的 URL 地址。
  1. permanent(301 永久重定向)
  • 当重写完成后,以永久重定向的方式返回重写后生成的新 URL 给客户端,状态码为 301。
  • 浏览器地址栏会显示跳转后的 URL 地址。
  1. break
  • 重写完成后,停止对当前 URL 在当前 location 以及其他 location 中(当前 serve)后续的其它重写操作。
  • 不会跳出 location 作用域,也不会重新搜索与更改后的 URI 相匹配的 location。
  • 适用于一个 URL 一次重写的场景。
  1. last
  • 重写完成后,停止对当前 URI 在当前 location 中后续的其它重写操作。
  • 但会对新的 URL 启动新一轮重写检查,并可能跳出当前 location 作用域,搜索与更改后的 URI 相匹配的 location。
  • 适用于一个 URL 可能需要多次重写的场景。

二. last 和 break 区别

server {listen 80;server_name  pic.path-analytics.com;root /tmp/html/;location / {rewrite /1.html /2.html;rewrite /2.html /3.html;}location /2.html {rewrite /2.html /a.html;}location /3.html {rewrite /3.html /b.html;}
}
情况一:无 flag

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述
执行顺序如下:

  1. 首先匹配 location

    在这里插入图片描述

  2. 然后根据第一个 rewrite 将 URL 由 /1.html 改写为了 /2.html

  3. 此时并未重新发起请求,而是在当前 location 中查找是否有关于 /2.html 的 重写规则

  4. 查找到第二个 rewrite 将 URL 由 /2.html 改写成 /3.html,再去查找当前 locaiton 中是否还有 /3.html 的重写规则

  5. 没有找到,此时 URL 为 http://pic.path-analytics.com/3.html

  6. 再次去请求,匹配 location
    在这里插入图片描述

  7. 进入该 location,将 URL 由 /3.html 改写为 /b.html。这个 location 中没有 /b.html 的改写规则,此时 URL 为 http://pic.path-analytics.com/b.html

  8. 再次去请求,匹配 location
    在这里插入图片描述

  9. 但是该 location 中没有 /b.html 的匹配规则,所以直接响应 b.html

情况二:break
location / {rewrite /1.html /2.html  break;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述

执行顺序如下:

  1. 首先匹配 location
    在这里插入图片描述
  2. 执行第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. break 直接终止了当前 location 和其他 location 的匹配,返回 2.html
情况三:last
location / {rewrite /1.html /2.html  last;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:
在这里插入图片描述
执行顺序如下:

  1. 首先匹配 location
    在这里插入图片描述
  2. 执行第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. last 终止了当前 location 中的匹配,此时 URL 为 http://pic.path-analytics.com/2.html
  4. 再次去请求,匹配 location
    在这里插入图片描述
  5. 根据 rewrite 将 URL 由 /2.html 改写为 /a.html,此时 URL 为 http://pic.path-analytics.com/a.html
  6. 再次去请求,匹配 location
    在这里插入图片描述
  7. 该 location 中没有 /a.html 的匹配规则,所以直接响应 a.html
情况四:修改 location 优先级

在 location 中使用正则匹配

location ~ / {rewrite /1.html /2.html  last;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述
执行顺序如下:

  1. 首先去匹配 location
    在这里插入图片描述
  2. 根据第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. last 终止了当前 location 中的匹配,此时 URL 为 http://pic.path-analytics.com/2.html
  4. 再次去请求,由于 location 中正则匹配的优先级高于普通匹配,匹配 location
    在这里插入图片描述
  5. 在该 location 中,根据 rewrite 将 URL 由 /2.html 改写为 /3.html,此时 URL 为 http://pic.path-analytics.com/3.html
  6. 再次去请求,由于 location 中正则匹配的优先级高于普通匹配,匹配 location
    在这里插入图片描述
  7. 在该 location 中没有找到 /3.html 的重写规则,所以直接响应 3.html

三. 不同 flag 下浏览器与网络请求的不同表现

location / {rewrite /1.html /2.html [flag];rewrite /2.html /3.html;
}location /2.html {rewrite /2.html /a.html;
}
情况一:没有 flag

在这里插入图片描述

情况二:break

在这里插入图片描述

情况三:last

在这里插入图片描述

情况四:redirect

在这里插入图片描述

情况五:permanent

在这里插入图片描述

http://www.hrbkazy.com/news/9901.html

相关文章:

  • 中国银行全球门户网站什么是seo
  • wordpress设定密码seo优化教程培训
  • 建设b2c商城网站定免费推广的平台都有哪些
  • 做的网站有营销效果吗seo优化方案策划书
  • 九江网站建设优化公司软文推广平台排名
  • 引导企业做网站关键词搜索引擎又称为
  • 百度站长反馈武汉seo首页优化报价
  • 佛山网站设计模板sem与seo的区别
  • 网站建设 成都完美日记网络营销策划书
  • 长沙手机网站建设公司哪家好如何免费做网站网页
  • 网站怎么做效果更好企业短视频推广
  • 把网站做app百度seo推广价格
  • 我找别人做的网站现在不管了怎么办百度竞价排名多少钱
  • 网站开发需要什么设备网站如何推广出去
  • 大连网站制作最好的公司企业网上的推广
  • 郑州做网站网站建设费用网址创建
  • 织梦系统做的网站怎么看网站日志徐州百度搜索网站排名
  • 品牌设计论文题目搜索引擎的关键词优化
  • 建设专业网站运营团队seo双标题软件
  • 企业如何做网站推广网站策划是什么
  • 网站建设_seo技术支持长沙seo网络优化
  • 网站销售系统怎么做制作网站的基本步骤
  • h5网站怎么做关键词排名规则
  • 哪个网站可以帮助做数学题郑州seo顾问外包
  • 建设网站e护航下载微信广告投放推广平台
  • word网站链接怎么做网址查询入口
  • 承德市宽城县建设局网站网络营销推广的目的
  • 网站功能建设流程图网站seo需要用到哪些工具
  • 怎么做网站发布合肥做网站哪家好
  • 网站制作洋网络sem是什么意思中文