简体   繁体   English

IIS网址重写模块重定向网址,该网址不会退出到存在的网址

[英]IIS Url Rewrite Module redirect url that does not exit to one that exists

Is there a way to redirect to a URL when a user inputs a URL in the browser that does not have an actual address but is under said domain, using the URLRewrite Module in IIS 7.5 or 8.5? 当用户使用IIS 7.5或8.5中的URLRewrite模块在用户在浏览器中输入没有实际地址但在所述域下的URL时,是否可以重定向到URL?

example: https://examplesite.com/test 示例: https//examplesite.com/test

redirected to: https://examplesite.com/site/home.aspx 重定向到: https : //examplesite.com/site/home.aspx

   <rewrite>
        <rules>
            <rule name="redirectURL" enabled="true" stopProcessing="true">
                <match url="^.*(/test)$" />
                <action type="Redirect" url="https://examplesite.com/site/home.aspx" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>

Every entry I have tried using this module does not seem to work for this scenario. 我尝试使用此模块尝试的每个条目似乎不适用于这种情况。

I don't know if you can do it under IIS Rewrite rules but you can define custom error handling 我不知道您是否可以在IIS Rewrite规则下执行此操作,但是可以定义自定义错误处理

<customErrors defaultRedirect="ErrorPage.aspx" mode="On">       
    <error statusCode="404" redirect="https://examplesite.com/site/home.aspx" />
</customErrors>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM