我有可以在 iis 上运行的常规 html 网站。添加 web.config 文件后,为了重写,我有多个页眉和页脚。如果我没有 web.config 文件来重写网站,但每次当你重新...
我有一个可以在 iis 上运行的常规 html 网站。添加 web.config 文件后,为了重写,我有多个页眉和页脚。
如果我没有用于重写站点工作的 web.config 文件,但每次刷新页面时都会出现 404 错误。这是我的 html 和 web.config:
`<HTML>
<HEAD>
<TITLE>Gaia kooli tunniplaani infosüsteem </TITLE>
<META NAME="Generator" CONTENT="Gaia kool 2024">
<META NAME="Author" CONTENT="Gaia Kool">
<META NAME="Keywords" CONTENT="Gaia kooli tunniplaani infosüsteem">
<meta http-equiv="expires" content="0">
</HEAD>
<script>
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
var urlPath = document.location.pathname;
var lastSlashIndex = urlPath.lastIndexOf('/');
urlPath = urlPath.substr(0, lastSlashIndex + 1) + event.data;
window.frames['main'].location.href = document.location.protocol + '//' + document.location.host + '/' + urlPath;
}
</script>
<frameset rows="72,50,*,30" border="0" framespacing="0" frameborder="0">
<frame src="frames/title.htm" scrolling=no>
<frame src="frames/navbar.htm" scrolling=no>
<frame src="welcome.htm" scrolling=auto name="main">
<frame src="frames/fuss.htm" scrolling=no>
</frameset>
<body>
<noframes><p>This page uses frames but your Browser does not support them.</noframes>
</body>
</HTML>`
和 web.config:
`<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>`
感谢帮助!