Solved

Redirect to HTTPS and maintain URL

Posted on 2009-06-29
12
849 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
Comment Utility
0
 
LVL 38

Author Comment

by:Justin Smith
Comment Utility
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
Comment Utility
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
 
LVL 38

Author Comment

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

Expert Comment

by:itgroove
Comment Utility
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
Comment Utility
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 13

Expert Comment

by:itgroove
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
RQC,

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

Expert Comment

by:rgc6789
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
IIS7 FTP default folder 8 69
Configure WPAD via DNS 3 49
CMAL Query - Jsom 1 38
Editing XSL files, 2 18
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now