IIS 重写规则 - href 和 src 不工作
IIS rewrite rules - href and src not working
我正在寻求用户友好方面的帮助 URL。我正在尝试在 IIS 中使用 "rewrite rules"。重写这个 PHP 文件确实有效,甚至传递了 id 参数并呈现了文章,但是我们在链接中的 href 和在脚本标签中的 src 的地址是错误的,因此它们无法加载这些资源。
<rewrite>
<rules>
<rule name="Rewrite to skaly.php">
<match url="^skaly$" />
<action type="Rewrite" url="skaly.php" />
</rule>
<rule name="Rewrite to skaly2.php">
<match url="^skaly/([0-9]+)$" />
<action type="Rewrite" url="skaly.php?aktualita={R:1}" />
</rule>
</rules>
</rewrite>
控制台日志打印屏幕:
<link rel="stylesheet" href="css/font-awesome-4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link href="css/lightbox.css" rel="stylesheet" type="text/css"/>
<link rel="import" href="DESYREL_.ttf">
感谢您的建议。
您日志中的每个 URL 路径都以 /skaly/
开头,但我猜这些资产是相对于您的网络根目录的。在 URL 前加上 /
,例如/css/styles.css
,因此它们成为根相对。
我正在寻求用户友好方面的帮助 URL。我正在尝试在 IIS 中使用 "rewrite rules"。重写这个 PHP 文件确实有效,甚至传递了 id 参数并呈现了文章,但是我们在链接中的 href 和在脚本标签中的 src 的地址是错误的,因此它们无法加载这些资源。
<rewrite>
<rules>
<rule name="Rewrite to skaly.php">
<match url="^skaly$" />
<action type="Rewrite" url="skaly.php" />
</rule>
<rule name="Rewrite to skaly2.php">
<match url="^skaly/([0-9]+)$" />
<action type="Rewrite" url="skaly.php?aktualita={R:1}" />
</rule>
</rules>
</rewrite>
控制台日志打印屏幕:
<link rel="stylesheet" href="css/font-awesome-4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link href="css/lightbox.css" rel="stylesheet" type="text/css"/>
<link rel="import" href="DESYREL_.ttf">
感谢您的建议。
您日志中的每个 URL 路径都以 /skaly/
开头,但我猜这些资产是相对于您的网络根目录的。在 URL 前加上 /
,例如/css/styles.css
,因此它们成为根相对。