使用URL重写模块的IIS 8.5中的URL别名
我需要为大量应用程序创建易于记忆的URL,该URL重定向到长且难以记忆的路径 i、 e。 subdomain.domain.edu/shortname 重定向到 我正在使用IIS8.5中的URL重写模块,但是当我浏览到短别名时,我总是得到404。我知道重写模块正在工作,因为我使用它来处理将HTTP重写为HTTPS以及将WWW添加到URL 我的重写规则如下所示:使用URL重写模块的IIS 8.5中的URL别名,iis,alias,url-redirection,Iis,Alias,Url Redirection,我需要为大量应用程序创建易于记忆的URL,该URL重定向到长且难以记忆的路径 i、 e。 subdomain.domain.edu/shortname 重定向到 我正在使用IIS8.5中的URL重写模块,但是当我浏览到短别名时,我总是得到404。我知道重写模块正在工作,因为我使用它来处理将HTTP重写为HTTPS以及将WWW添加到URL 我的重写规则如下所示: <rewrite> <rules> <rule name
<rewrite>
<rules>
<rule name="Easy to remember shortcut" stopProcessing="true">
<match url=".*subdomain.domain.edu/shortname" />
<conditions>
<add input="{URL}" pattern=".*/shortname" />
</conditions>
<action type="Redirect" url="https://www.subdomain.domain.edu/mainApplication/subfolder/page.aspx" />
</rule>
</rules>
</rewrite>
当然,这会返回404。有什么想法吗
请原谅,如果在另一篇文章中已经有了答案,我已经阅读并尝试了超过30篇关于URL重写模块的帖子,但还没有找到实际创建别名的解决方案。URL重写匹配条件将无法看到您的域,即如果URL是匹配部分,则只能看到shortname(在domainname/之后的任何内容) 要验证主机,我们需要添加conditions子句。因此,您的规则如下所示
<rule name="shortnameURL" enabled="true" stopProcessing="true">
<match url="shortname" />
<action type="Redirect" url="mainApplication/subfolder/page" />
<conditions>
<add input="{HTTP_HOST}" pattern=".*subdomain.domain.edu" />
</conditions>
</rule>
如果在这里添加整个URL,也应该可以
如下所示
请检查我的答案,如果我遗漏了什么,请告诉我