Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect to application root using the IIS7 URL Rewrite Module?

I have tried:

1) I tried empty string first:

<action type="Redirect" url="" redirectType="Permanent" appendQueryString="false" />

Result:

HTTP 500.52 - URL Rewrite Module Error.
The substitution URL for the current action cannot be empty.

2) Maybe I should omit the url attribute:

<action type="Redirect" redirectType="Permanent" appendQueryString="false" />

Same result:

HTTP 500.52 - URL Rewrite Module Error.
The substitution URL for the current action cannot be empty.

3) What about the ASP.NET way:

<action type="Redirect" url="~" redirectType="Permanent" appendQueryString="false" />

Tries to redirect to {APP_ROOT}/~.

4) Last try:

<action type="Redirect" url="/" redirectType="Permanent" appendQueryString="false" />

As expected, it redirects to the root of the server...

I'd like to find some clean generic solution. (I cannot use some concrete /myCurrentAppPath.)

like image 385
TN. Avatar asked Mar 11 '10 10:03

TN.


2 Answers

This works better:

<action type="Redirect" url="." redirectType="Permanent" appendQueryString="false" />
like image 147
nsimeonov Avatar answered Oct 22 '22 00:10

nsimeonov


For now try this, it's not clean but it works:

<action type="Redirect" url="?" redirectType="Permanent" appendQueryString="false" />
like image 2
lioil Avatar answered Oct 22 '22 00:10

lioil