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

x
  • 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?
0
Orbsol
Asked:
Orbsol
  • 2
  • 2
1 Solution
 
Springy555Commented:
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:
http://www.15seconds.com/issue/081205.htm


You can also use the HTTP Redirect feature in IIS7:
http://technet.microsoft.com/en-us/library/cc770409(WS.10).aspx


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";
Response.AddHeader("Location","http://mysite.com/mainsite");
}
</script>

Open in new window

0
 
poweredsCommented:
Hi Orbsol,

Please see below link.
http://www.experts-exchange.com/Software/Internet_Email/File_Sharing/HTTP/Q_24829782.html
Just change the url to http://mysite.com/mainsite.

Hope this helps.
0
 
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.
0
 
Springy555Commented:
What sort of errors are you getting when you try the second method?

Here is another guide that might help:
http://www.trainsignaltraining.com/windows-server-2008-http-redirection/2008-03-27/
0
 
OrbsolAuthor Commented:
Agh, it seems I misunderstood what the tick boxes meant. Your suggested URL put me straight, thank you.
0

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