Nginx篇之配置隐式页面跳转
2021/7/21 7:09:43
本文主要是介绍Nginx篇之配置隐式页面跳转,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、说明
nginx实现隐式页面跳转
所谓隐式:顾名思义,即就是当访问该地址时,实际访问的页面地址与输入的地址不一致。
实现页面的跳转,在浏览器中URL保持不变。
一般常用于当需要将某个访问的浏览器地址进行流量关闭或者限制访问时,执行该操作
二、示例
举例:将请求路径https://testa.com/home/test跳转到https://testb.com/home/test/test.html页面
server { listen 443; server_name testa.com; include server/ssl.conf; location = /home/test { rewrite /home/test /home/test/test.html break; proxy_pass https://testb.com; } }
解释:
当匹配到https://testa.com/home/test 或者 http://testa.com/home/test/test.html 时,进行break跳出,执行下面语句proxy_pass。跳转至https://testb.com/home/test.test.html页面。
注:其中rewrite表示可以将nginx提供的全局变量或自己设置的变量,结合正则表达式进行url重写以及重定向。
这篇关于Nginx篇之配置隐式页面跳转的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-29fail2ban nginx
- 2024-03-18install nginx proxy manager
- 2024-01-2444从零开始用Rust编写nginx,命令行参数的设计与解析及说明
- 2024-01-22比Nginx更好用的Gateway!
- 2024-01-17nginx daemon off
- 2023-12-30Nginx Vhost Traffic Status 是什么意思-icode9专业技术文章分享
- 2023-12-26使用nginx搭建creates.io镜像(稀疏索引)
- 2023-11-18centos7编译安装Nginx教程。
- 2023-11-02nginx启动命令和停止命令
- 2023-10-25Centos7系统Nginx负载均衡如何安装和配置?