Solved

Redirect to HTTPS and maintain URL

Posted on 2009-06-29
12
860 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
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

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

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

The vision: A MegaMenu for a SharePoint portal home page The mission: Make it easy to maintain. Allow rich content and sub headers as well as standard links. Factor in frequent changes without involving developers or a lengthy Dev/Test/Prod rel…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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