I'm trying to setup a redirect from http://mail.example.com
to https://mail.example.com/owa
. I've been unsuccessful in doing this by using IIS's HTTP Redirect so I looked to other options. The one I settled on is to create a default document in the wwwroot folder to handle the redirect.
I created a file called index.aspx (and added index.aspx to the list of default documents) and put the following code in it:
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","https://mail.example.com/owa");
}
</script>
Instead of getting a redirect I get:
403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.
I've been trying to find an answer to this but have been unsuccessful so far. One thing I did try was to add the Everyone group to wwwroot with read access. No change.
The AppPool for Default Web Site is DefaultAppPool and the Identity is ApplicationPoolIdentity. (I don't know what these things are but maybe knowing this will help you.)
You could double check if Anonymous Authentication is enabled for the default web site, and the other authentication types (e.g. forms) are disabled?: http://technet.microsoft.com/en-us/library/cc770966(WS.10).aspx
Often the file system permissions can be correct, but IIS still won't allow users through if the authentication settings are wrong.
I am not sure if you have seen this documentation Simplify the Outlook Web App URL. For the other method of creating a default document, you can check KB555053.
I would still prefer using HTTP Redirect module in IIS 7 instead of the default page as thats much better and easy.
Edit:
I created a simple owa folder under wwwroot directory and configured HTTP Redirect. This is how the web.config file looks like.
you can also change your two lines of code to the following:
Response.Redirect("https://mail.mydomain.com/owa");
Just change the 403 error to redirect to https://site/owa