Reputation: 116920
I am trying to configure IIS 7.0 such that when I enter:
http://example
it should redirect the user to
http://example/Directory
but should still display http://example
. Can someone please tell me how to achieve this?
Currently, my setup is as follows (inside IIS Manager):
Application Pools
Sites
- Default Web Site
- - Directory
Upvotes: 1
Views: 660
Reputation: 3279
If you consider using IIS URL Rewrite module, you can use following rule:
<rule name="RewriteToSubdir" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="example\.com" />
</conditions>
<action type="Rewrite" url="/Directory/{R:1}" />
</rule>
Upvotes: 0
Reputation: 14941
I'm assuming you are using web forms. My team faced a similar obstacle. We wanted user-friendly URLs and mapping, so we opted for turning our project into a web forms/mvc hybrid. That way we get the benefit of having a routing engine. Here's an example:
routes.MapPageRoute(null, "default.aspx", "~/dashboard/default.aspx");
That maps /mysite/default.aspx to/mysite/dashboard/default.aspx, but actually displays /mysite/default.aspx in the browser's address bar. If this is an option for your team, you should look into tutorials on how to create a web forms/mvc hybrid. Here's one example.
Upvotes: 1
Reputation: 51
Assuming you can't change the Physical Path variable under the basic settings, you could try a default document in the root of the site that executes the page in the subfolder like this:
server.execute("/Directory/");
Upvotes: 1
Reputation: 415971
Put this as the entire contents of the default.aspx or default.asp file in your root folder:
<%Server.Transfer("/Directory")%>
Upvotes: 1