Solved

Redirect to HTTPS and maintain URL

Posted on 2009-06-29
12
857 Views
Last Modified: 2012-05-11
What is the easiest way to redirect a URL to https:// ?  I need to make sure that the rest of the URL is maintained.  This is a sharepoint (wss 3) site running in IIS 6.  
0
Comment
Question by:Justin Smith
  • 6
  • 2
  • 2
  • +1
12 Comments
 
LVL 13

Expert Comment

by:shadowlesss
ID: 24736759
0
 
LVL 38

Author Comment

by:Justin Smith
ID: 24736860
I need to maintain the URL they type in (just add https instead of http).....so I can't necessarily redirect every request to one static URL.
0
 
LVL 13

Expert Comment

by:shadowlesss
ID: 24737107
IIS 7.0 found on Windows Server 2008 has this a rewrite module that can be coded to do this sort of thing.  If you need to do this with IIS 6.0 then you will need to consider some 3rd party solutions as this functionality is not native to IIS 6 or lower version
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 38

Author Comment

by:Justin Smith
ID: 24737180
Surely there is an ASP script or something to do this???
0
 
LVL 13

Expert Comment

by:itgroove
ID: 24738085
ACH1LLES,
For SharePoint to properly support the use of HTTPs (and I'm assuming your SharePoint Web application right now is not using HTTP, thus your request), you need to implement an Alternate Access Mapping (AAM).
The high level steps are this:
1. Extend the Web application (in Central Admin) your site site is in now to use another URL - in the 'extend web application' dialog, you'll get prompted for the URL and port (443) and the option to use SSL
2. Perform an IISRESET so that your new extended web application appears in IIS
3. Then go into IIS and bind your SSL certificate to that new extended web application (I'm assuming you already have an SSL certificate or are planning to get one)
4. Advise your users that the URL exists, perform whatever redirect, etc. so you have a properly supported SharePoint site on the port/URL necessary
Reference link if you want the nitty gritty: http://technet.microsoft.com/en-us/library/cc288609.aspx
A great series from the SharePoint Team - http://blogs.msdn.com/sharepoint/archive/2007/03/06/what-every-sharepoint-administrator-needs-to-know-about-alternate-access-mappings-part-1.aspx
0
 
LVL 38

Author Comment

by:Justin Smith
ID: 24740126
Groove,

It's already working on 443......if they try to access on 80 I want them to be redirected to 443 (instead of getting the 403.4 error).  This would be an easy task if I wanted 80 and 443 to be available (by using AAM's), but I don't want 80 at all, I want 80 to redirect to 443.  
0
 
LVL 13

Expert Comment

by:itgroove
ID: 24740393
Ah, sorry, I see.
Here's a screenshot regarding what you'd want to do on your HTTP site (not the HTTPS site), in IIS. I'm assuming you are on Windows Server 2003, but you'd be looking for similar functionality on Windows Server 2008.

IISRedirect.png
0
 
LVL 5

Expert Comment

by:rgc6789
ID: 24740957
In the above screen, put https://www.portalsomewhere.com$S$Q in the Redirect to:. This will keep the page they are on but forward them to the new URL. You may (or may not) want to make this a Permanent Recirect also.
0
 
LVL 38

Author Comment

by:Justin Smith
ID: 24741114
Thanks for the responses.  Yeah I know I can do it this way, by making a seperate IIS site and redirecting.  I was thinking there was a way to make a custom 403.4 page to do the redirection so I wouldn't need to create the additional IIS site.  I can make a custom page to do the redirection, but I need to know how to do it and also keep the original URL in tact.
0
 
LVL 38

Author Comment

by:Justin Smith
ID: 24741121
RQC,

I will try this (but would prefer a custom 403.4 error page :) )
0
 
LVL 5

Expert Comment

by:rgc6789
ID: 24741568
Yes, you can also do it by reading the server variables URL and QUERY_STRING and building the Redirect. Classic ASP would be like this:
RedirectURL = "www.whatever.com" & Server.Variables("URL")
 
If Len(Server.Variables("QUERY_STRING")) > 0 then
    RedirectURL = RedirectURL & "?" & Server.Variables("QUERY_STRING")
End If
 
Response.Redirect RedirectURL

Open in new window

0
 
LVL 38

Accepted Solution

by:
Justin Smith earned 0 total points
ID: 24925788
Created an html page with the following script in it and saving at wwwroot.  In my custom errors for the site I pointed the 403.4 to this file and it solved my issue.

<SCRIPT type=text/javascript>
<!--
if (location.protocol != 'https:')
{
window.location = 'https://'+ location.host + location.pathname + location.search;
}
</SCRIPT>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question