redirect from application(on root domain level) to subapplication
My hosting supports only web.config IIS configuration. I want to redirect my
http://domain -> http://do开发者_如何学JAVAmain/X
and here is my try
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="http://domain/X/" />
</system.webServer>
</configuration>
it works, but the trouble it works for all sites and when I already on http://domain/X/ it still working so I'm getting recursion http://domain/X/X/X/X/X/X/X etc...
Temporary solution is to put
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" />
</system.webServer>
</configuration>
into http://domain/X and http://domain/Y etc... but when I go to the http://domain/Y/Z it anyways redirects me to http://domain/X/Z/ (so hell I don't really want to put this in any folder)
So I think I need to fix first redirection (Somehow) to make it works only for http://domain/
thank you.
You can try setting childOnly
attribute - as per documentation, this would redirect only if the file name is present in the url. So only urls of form http://domain/<file name>
would get redirected to http://domain/X/<file name>
and that should solve your issue. For redirecting http://domain/
, you may use a default document redirecting to http://domain/X
.
You may also look at URL Rewrite module - see http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/ (but of course, it will not issue HTTP redirects if that is the need)
精彩评论