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 ...
随机推荐
- [.Net] 一句话Linq(递归查询)
功能查询起止日期范围内连续的月份列表. /* Period */ cbxPeriod.DataSource = Enumerable.Range(, ).Select(t => DateTime ...
- Fiddler使其在HttpURLConnection下正常抓包
像陌陌这样使用HttpURLConnection进行通讯的APP还是无能为力 还需要对fiddler进行如下设置: 点击"Rules->CustomizeRules"; 在这 ...
- 利用Python进行数据分析 第6章 数据加载、存储与文件格式(2)
6.2 二进制数据格式 实现数据的高效二进制格式存储最简单的办法之一,是使用Python内置的pickle序列化. pandas对象都有一个用于将数据以pickle格式保存到磁盘上的to_pickle ...
- Markdown语法图文全面详解(转)
基本语法参考 转自:https://blog.csdn.net/u014061630/article/details/81359144 更改字体.颜色.大小,设置文字背景色,调整图片大小设置居中 ...
- openfeign与gateway中的httpClient类声明冲突
启动spring cloud中的网关,报错: ***************************APPLICATION FAILED TO START*********************** ...
- Codeforces-975C - Valhalla Siege 前缀和 思维
C. Valhalla Siege time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- docker registry-v2 搭建私有仓库
参考官方文档:https://docs.docker.com/registry/deploying/ 参考 :http://www.tuicool.com/articles/6jEJZj 本例子使用两 ...
- C#插入时间
//获取日期+时间 DateTime.Now.ToString(); // 2008-9-4 20:02:10 DateTime.Now.ToLocalTime().ToString(); // 20 ...
- ASP.NET Core 2.1 中的 HttpClientFactory (Part 1) HttpClientFactory介绍
原文:https://www.stevejgordon.co.uk/introduction-to-httpclientfactory-aspnetcore 发表于:2018年1月 ASP.NET ...
- Python中函数的知识点
1.函数的定义与调用 2.函数的参数 3.函数的返回值 1. 1.1.函数的定义: 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 1.2.定义一个函数: 规则: 函数代码块以 ...