Reputation: 11
We have a main address which example1.example.com and we have a Https certificate issued for this address. But the main code is on example2.example.com and we used to redirect the first one to this one. Now we want to use https and I want to know if it's possible for us to do so. We don't have any https certificate on the 2nd server.
Upvotes: 1
Views: 322
Reputation: 317
For me the best and easiest method on IIS 7.x to do redirection is with the URL Rewite module of Microsoft:
Upvotes: 1
Reputation: 41838
In Global.asax I have this block:
if (Request.ServerVariables["HTTPS"] != "on")
{
Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "https://"), true);
return;
}
This turns http requests into https, which you will want to do on example1, if example2 refers back to example1.
For what you want to do, this should work:
if (Request.ServerVariables["HTTPS"] == "on")
{
Response.Redirect(Request.Url.AbsoluteUri.Replace("https://", "http://"), true);
return;
}
Upvotes: 0