[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 764
  • Last Modified:

IIS7 HTTP Redirection

Can somebody please help me to set up a http redirect in IIS7 as every setting I try seems not give the outcome I'd like.

I have a public website setup but the software has created it as a sub-folder. So basically I'd like to permanently redirect browsers to the sub folder. E.g. If they got to http://www.mysite.com that they are permanently redirected to http://www.mysite.com/mainsite.

Can someone please confirm the correct settings?
  • 2
  • 2
1 Solution
There are a few solutions you can use to achieve your redirection.

The best method would be to use the IIS7 URL ReWrite module.  Here is a guide on how you can use it:

You can also use the HTTP Redirect feature in IIS7:

You can also use plain old code.  Setup a default page for http://mysite.com called something like default.aspx.

Add the code below to this page - note you can edit the destination to any URL.  In this case you can redirect to http://mysite.com/mainsite:

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";

Open in new window

Hi Orbsol,

Please see below link.
Just change the url to http://mysite.com/mainsite.

Hope this helps.
OrbsolAuthor Commented:
Thank you for your comprehensive reply.

Your second method was what I had been trying to use but despite trying different settings I never actually achieved what I thought was a relatively simple request.

I have downloaded the rewrite module but again cannot seem to achieve my goal. The examples they give don't quite reflect what I'm trying to achieve. Can you give me an idiots guide to the setup?

I'm sure your last suggestion will work but I would prefer one of the former solutions if I can.
What sort of errors are you getting when you try the second method?

Here is another guide that might help:
OrbsolAuthor Commented:
Agh, it seems I misunderstood what the tick boxes meant. Your suggested URL put me straight, thank you.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now