2012-04-12 163 views
2

我知道这个问题已被问过,但我还没有找到我遇到的问题的答案。我正尝试将一个域(而不是子域)重定向到一个子文件夹。我运行IIS 7,我创造了这样的URL重写规则:IIS 7的URL重写 - 403错误

<rule name="subfolder" enabled="true" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions logicalGrouping="MatchAll"> 
     <add input="{HTTP_HOST}" pattern="^(www\.)?domain.com$" /> 
     <add input="{PATH_INFO}" pattern="subfolder" negate="true" /> 
    </conditions> 
    <action type="Rewrite" url="/subfolder/{R:0}" /> 
</rule> 

与规则的时候,我可以导航到一个页面像http://domain.com/subfolder/index.htm。有了它,当我尝试导航到http://domain.com/index.htm时,出现403错误。

403 - Forbidden: Access is denied. 

You do not have permission to view this directory or page using the credentials that you supplied. 

我该如何解决这个问题?

回答

2

试试这个简单的规则:

<rule name="Redirect domain to sub-folder" stopProcessing="true"> 
    <match url="^$" /> 
    <action type="Redirect" url="http://domain.com/subfolder" /> 
</rule> 
+0

感谢。我希望不要重定向,但这可能是我唯一的选择。 – HotRodRamy 2012-04-15 22:57:28