Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Redirect to HTTPS and maintain URL

Posted on 2009-06-29
12
Medium Priority
?
862 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

610 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