IIS URL rewrite in child virtual directory not redirecting

心已入冬 提交于 2019-12-23 08:53:06

问题


I have Asp.NET Application installed on 'default web site\orchard'... accessible at http://localhost/orchard, and I want to use URL Rewrite. I added rules:

<rewrite>
    <rewriteMaps>
        <rewriteMap name="Blogger">
            <add key="/aaa" value="/tags/tag1" />
        </rewriteMap>
    </rewriteMaps>
    <rules>
        <clear />
        <rule name="Rewrite rule1 for Blogger" stopProcessing="true">
        <match url=".*" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{Blogger:{REQUEST_URI}}" pattern="(.*)" />
            </conditions>
            <action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

But when I go to http://localhost/orchard/aaa then error 404 is returned instead of redirecting to http://localhost/orchard/tags/tag1.

When I put my web application in the root folder of website redirection works. http://localhost/aaa is redirected to http://localhost/tags/tag1.

What I'm doing wrong?

Thanks for help.

来源:https://stackoverflow.com/questions/10367154/iis-url-rewrite-in-child-virtual-directory-not-redirecting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!