浏览器刷新404错误
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Vue]]
&color(red){※前提条件:本文基于 Vue 2.0 创作};
#contents
* 浏览器刷新404错误 [#cdce6056]
* 原因 [#p52b8cc9]
问题原因我就不说了,官网已经说了,想了解的看这里
https://router.vuejs.org/zh/guide/essentials/history-mod...
* 对策 [#x1027018]
在网上搜了大部分的IIS的解决方案如下:
** 安装 IIS UrlRewrite [#vc57e29c]
** 修改 web.config [#tceb297f]
在你的网站根目录中创建一个 web.config(如果已经存在,就不...
#codeprettify{{
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/50...
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="Is...
<add input="{REQUEST_FILENAME}" matchType="Is...
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
}}
但是完全按照这个配置后,刷新页面没有问题了,但是请求却不...
*** 原因 [#i1a6a206]
添加配置后Cache-Control被改成了private,代表只有页面第一...
*** 解决方法1 [#a4557438]
将匹配的正则表达式<match url="(.*)" /> 改成 <match url="(...
http://aaa.bbb.com/home/desktop/process
但是请求数据的链接是:
http://aaa.bbb.com/api/Account/Login
修改后,配置只对页面链接起做用。这样刷新后既不报404错误,...
*** 解决方法2 [#ie63f650]
或者如下:匹配所有不包含api的数据请求
#codeprettify{{
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/50...
<match url="(^(?!.*?api).*$)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="Is...
<add input="{REQUEST_FILENAME}" matchType="Is...
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
}}
#hr();
コメント:
#comment_kcaptcha
終了行:
[[Vue]]
&color(red){※前提条件:本文基于 Vue 2.0 创作};
#contents
* 浏览器刷新404错误 [#cdce6056]
* 原因 [#p52b8cc9]
问题原因我就不说了,官网已经说了,想了解的看这里
https://router.vuejs.org/zh/guide/essentials/history-mod...
* 对策 [#x1027018]
在网上搜了大部分的IIS的解决方案如下:
** 安装 IIS UrlRewrite [#vc57e29c]
** 修改 web.config [#tceb297f]
在你的网站根目录中创建一个 web.config(如果已经存在,就不...
#codeprettify{{
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/50...
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="Is...
<add input="{REQUEST_FILENAME}" matchType="Is...
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
}}
但是完全按照这个配置后,刷新页面没有问题了,但是请求却不...
*** 原因 [#i1a6a206]
添加配置后Cache-Control被改成了private,代表只有页面第一...
*** 解决方法1 [#a4557438]
将匹配的正则表达式<match url="(.*)" /> 改成 <match url="(...
http://aaa.bbb.com/home/desktop/process
但是请求数据的链接是:
http://aaa.bbb.com/api/Account/Login
修改后,配置只对页面链接起做用。这样刷新后既不报404错误,...
*** 解决方法2 [#ie63f650]
或者如下:匹配所有不包含api的数据请求
#codeprettify{{
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/50...
<match url="(^(?!.*?api).*$)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="Is...
<add input="{REQUEST_FILENAME}" matchType="Is...
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
}}
#hr();
コメント:
#comment_kcaptcha
ページ名: