IIS:URL Rewrite实现vue的地址重写
vue-router
全局配置
const router = new VueRouter({
mode: 'history',
routes: [...]
})
URL Rewrite
1、添加规则

2、设置规则
使用正则表达式匹配网址,模式:就是正则表达式;

条件可以设置服务器变量对应匹配,如上面只匹配www.local.com
服务器变量
https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524602(v=vs.90)

这里的{R:0}就是上面正则表达式匹配的内容:可以通过测试模式查看;也可以通过正则表达式的分组匹配去做跳转规则

3、web.config
打开可以看到刚才的配置自动写入web.config的内容
<system.webServer>
<rewrite>
<rules>
<rule name="测试规则" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.local.com$" />
</conditions>
<action type="Redirect" url="http://www.asd.com/{R:0}" redirectType="Found" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.webServer>
<rewrite>
<rules>
<rule name="404/500跳转首页" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
404/500跳转首页
资源:
安装url-rewrite:
https://www.iis.net/downloads/microsoft/url-rewrite
正则表达式工具:
http://deerchao.net/tools/regester/index.htm
博客
https://shiyousan.com/post/635654920639643421
vue地址重写
IIS:URL Rewrite实现vue的地址重写的更多相关文章
- IIS URL Rewrite(URL 重写)-使用教程
IIS URL Rewrite(URL 重写)-使用教程 作者:vkvi 来源:千一网络(原创) 日期:2011-8-17 http://www.cftea.com/c/2011/08/9CRXOL ...
- Windows10中的IIS10安装php manager和IIS URL Rewrite 2.0组件的方法
Windows10中自带的Server:Microsoft-IIS/10.0,然后这个10却让原本支持组件无法安装了,php manager组件安装时提示“必须安装IIS7以上才可以安装”.那是不是真 ...
- IIS URL Rewrite Module防盗链规则配置方法
IIS版本:IIS 7.5 URL Rewrite组件:IIS URL Rewrite Module(http://www.iis.net/downloads/microsoft/url-rewrit ...
- Windows10 IIS安装php manager和IIS URL Rewrite 2.0组件的方法
Windows10中自带的Server:Microsoft-IIS///8.5/10上安装.微软脑子秀逗,跳过了9,以为能解决版本识别的问题,没想到弄成10,还是出现了版本识别的问题,真是自己打自己的 ...
- IIS URL Rewrite redirect from one Domain to another
IIS URL Rewrite enables Web administrators to create powerful rules to implement URLs that are easie ...
- IIS URL Rewrite Module的防盗链规则设置
IIS版本:IIS 7.5 URL Rewrite组件:IIS URL Rewrite Module(http://www.iis.net/downloads/microsoft/url-rewrit ...
- IIS URL Rewrite – Installation and Use
IIS URL Rewrite – Installation and Use Posted by Nick LeFevre | Leave a reply IIS URL Rewrite Instal ...
- iis url rewrite http->https non-www->www
<system.webServer> <rewrite> <rules> <rule name="Redirect abc.com to www&q ...
- 使用微软 URL Rewrite Module 开启IIS伪静态
原文 使用微软 URL Rewrite Module 开启IIS伪静态 在IIS5和IIS6时代,我们使用URL REWRITING可实现URL重写,使得WEB程序实现伪静态,但默认情况下只能实现.A ...
随机推荐
- (7)Spring Boot web开发 --- servlet容器
文章目录 配置嵌入式 Servlet 容器 注册 三大组件 使用其他 servlet 容器 使用外置的 `Servlet` 容器 配置嵌入式 Servlet 容器 Spirng Boot 默认使用自带 ...
- (一)SpringBoot Demo之 Hello World
文章目录 最终效果 pom文件编写 编写资源类 编写控制器 运行项目 原文 : https://spring.io/guides/gs/rest-service/ 类型:官网入门指南 要求:JDK1. ...
- WUSTOJ 1335: Similar Word(Java)
题目链接:1335: Similar Word Description It was a crummy day for Lur. He failed to pass to the CET-6 (Col ...
- CH09 开机自动烧录QSPI
版本信息: 版本 REV2018 时间 05/22/2018 XILINX ZYNQ LINUX篇 基于米联MZ7X系列 电子版自学资料 常 ...
- mtd-utils 的 使用
关于编译可以查看文章:<Arm-Linux 移植 mtd-utils 1.x> 查看信息 使用命令前用cat /proc/mtd 查看一下mtdchar字符设备:或者用ls -l /dev ...
- 启动 docker 容器时报错
错误信息: iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9300 -j DNAT --to-dest ...
- apply 和 call 的用法
apply的用法 语法 func.apply(thisArg, [argsArray]) thisArg 可选的.在func函数运行时使用的this值.请注意,this可能不是该方法看到的实际值:如果 ...
- 基于【 责任链模式】二 || 网关zuul过滤器封装
一.基于责任链模式封装网关拦截 上一篇文章中已经使用建造者模式对网关拦截进行封装,存在一个问题,在连接器build中,每一个拦截都要进行true判断,代码看起来冗余,下面使用责任链模式封装 1.基于责 ...
- VBA错误处理(十八)
在(VBScript/VBA)编程中有三种类型的错误: 语法错误 运行时错误 逻辑错误 语法错误 语法错误(也称为解析错误)发生在VBScript的解释时间. 例如,下面一行导致语法错误,因为它缺少一 ...
- js入门之内置对象Math
一. 复习数据类型 简单数据类型, 基本数据类型/值类型 Number String Boolean Null Undefined 复杂数据类型 引用类型 Object 数组 数据在内存中是如何存储的 ...