- Import-Module WebAdministration
- Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\Default Web Site" -Value @{enabled="true";destination="https://mail.contoso.com/owa";exactDestination="false";httpResponseStatus="Found";childOnly="true"}
or you can do it via the ol' Error Pages with this command
- .\appcmd.exe set config -section:system.webServer/httpErrors /+"[statusCode='403',responseMode='Redirect' ,path='https://mail.contoso.com/owa']" /commit:apphost