2011-06-16 130 views
1

我的主機只支持web.config IIS配置。我想重定向我從應用程序(在根域級別)重定向到子應用程序

http://domain - >http://domain/X

,這裏是我的嘗試

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <httpRedirect enabled="true" destination="http://domain/X/" /> 
    </system.webServer> 
</configuration> 

它的工作原理,但它適用於所有網站的麻煩,當我已經在http://domain/X/它仍然工作,所以我越來越遞歸http://domain/X/X/X/X/X/X/X等等

臨時解決方法是把

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <httpRedirect enabled="false" /> 
    </system.webServer> 
</configuration> 

http://domain/Xhttp://domain/Y等...但是當我去到http://domain/Y/Z它重定向反正我http://domain/X/Z/(所以地獄我真的不希望把這個任意文件夾中)

所以我想我需要修復第一次重定向(不知何故),使其僅適用於http://domain/

謝謝。

回答

2

您可以嘗試設置childOnly屬性 - 根據documentation,僅當文件名存在於url中時,纔會重定向。所以只有表格http://domain/<file name>的網址會被重定向到http://domain/X/<file name>,這應該可以解決您的問題。要重定向http://domain/,您可以使用重定向到http://domain/X的默認文檔。

你也可以看URL重寫模塊 - 見http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/(當然,它不會發出HTTP重定向,如果這是需要)

+0

我加childOnly =「真」,但結果還是一樣:HTTP :// domain/Y/Z它反正將我重定向到http:// domain/X/Z/- 這對我來說是錯誤的,我只想要域/重定向到domain/X並且能夠與domain/Y一起工作。 – Cynede 2011-06-16 10:12:58