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 ...
随机推荐
- composer 无法配置命令行写入配置文件问题
composer config repo.packagist composer https://packagist.phpcomposer.com 这条命令无法修改composer.json 添加中国 ...
- Python18之函数定义及调用,注释
一.函数定义 def 函数名(形参1,形参2...): 函数体 return 返回值 (可以返回任何东西,一个值,一个变量,或是另一个函数的返回值,如果函数没有返回值,可以省略retu ...
- c语言实现串
串 (string)是由零个或者多个字符组成的有限序列,又称字符串 一般表示为 S=“ a1 a2 a3 a4 . . . . . an” 其中S 是串名,双引号串起来的是串值,(有些书用单 ...
- 偷窥篇:重要的C#语言特性——30分钟LINQ教程
本文转自:http://www.cnblogs.com/liulun/archive/2013/02/26/2909985.html 千万别被这个页面的滚动条吓到!!! 我相信你一定能在30分钟之内看 ...
- Spring Cloud 基于Consul 实现配置服务
Spring Cloud体系中提供了Config组件来进行配置服务管理.而Consul除了提供服务注册与发现功能外,同时也提供配置管理功能.本位将介绍如何结合Spring Cloud + Consul ...
- SpringCloud使用Consul作为分布式配置中心
版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qq_36027670/article/de ...
- JQuery 的优先级
1.使用最新的jQuery版本 2.用对选择器. 2.1 jquery最快的选择器是ID选择器:来源于js的getElementById()方法 注释:需要选择多个元素,必然涉及到Dom遍历和循环 ...
- ES6中 对字符串增强
在曾经,我们只能用A.indexof(B)来判断A中是否含有B字符串: 现在在ES6中 有了: includes(), startswith(),endswith() reapt()重复次数: 输出 ...
- 使用httpwebrequest发送http请求
HttpWebRequest request = WebRequest.Create("url") as HttpWebRequest; request.Timeout = * * ...
- Subversion和TortoiseSVN,VisualSVN图文教程
转自:http://www.veryhuo.com/a/view/156054.html 本文为大家介绍一下SVN使用教程,在开始之前,您有必要了解一下为什么要使用SVN?因为程序员在编写程序的过程中 ...