[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 694
  • Last Modified:

redirect users in sharepoint running IIS6

Hi I have a sharpeoint 2007 server running on win2k3 IIS6. We've changed the FQDN for sharepoint and added the alternative access mappings within the admin site. We're running into a few problems. I've also added an SSL certificate and required a Secure connection. I replaced the 403:4 error with a simple redirect that will send users to the main site's root address https://portal.company.com. User's have hardcoded links and applications within sharepoint that use an unsecured and old web address. Is there a way to code the redirect 403:4 page to do a smart redirect? Can I have the address be parsed in and replace just the http with https? I was given this code by someone but it didn't successfully redirect.

redirect.aspx

<%@ Page Language="C#" %>

<%
    string newLocation = Regex.Replace(Request.ServerVariables["HTTP_REFERER"], "^http(://cour-intranet.*)$", "https$1");
%>
<html>
<head>
    <title>Redirecting to portal.company.com...</title>
</head>
<body>
    <p>
        You are now being redirected to <a href="<%= newLocation %>">
            <%= newLocation %></a>
    </p>
    <p>
        Please update your links to https://portal.company.com</p>
</body>
</html>
<%
    Response.Redirect(newLocation);
%>
0
jbla9028
Asked:
jbla9028
2 Solutions
 
rattlerantCommented:
I don't believe this is easily achievable in IIS6. I achieved this once with an F5 Load balancer infront of the IIS6 box (but we don't all have $60,000 for new hardware :) so ...

Why not upgrade to IIS7 on your WFE and then use the urlrewrite Module 2.0 (http://www.iis.net/download/urlrewrite)?

- Rattlerant
0
 
Brad HoweCommented:
Hi,

Based on my understanding, you just want a simple rewrite rule. If so, here is the rewrite rule you can use to acheive a redirect.

Helicon ISAPI Rewirte Lite
 Limitations - http://www.helicontech.com/isapi_rewrite/doc/litever.htm
 Download - http://www.helicontech.com/download/isapi_rewrite/ISAPI_Rewrite3_0073_Lite.msi

  It is free. or 99$/server for more advanced .htacess configurations.

One global httpd.conf configuration file will be loaded from Lite version installation folder.

In that folder add the following rule lines.

RewriteEngine on

 #Redirect non-HTTPS to HTTPS
   ReWriteCond %{SERVER_PORT} ^443$
   RewriteCond %{HTTP_HOST} ^MyDomain\.com
   RewriteRule ^(.*)$ https://www.Mydomain.com/$1 [R=301,L,QSA]

301 - redirect
L - Last rule
QSA - query String append

This reads as, if port is 443 and the URL entered is http://Mydomain.com/....?... then redirect to https://www.Mydomain.com/....?....

Let me know if you need help with the rule setup. With rewrite we can grab anything.

Cheers,
Hades666
0
 
mikeewaltonCommented:
Have you verified that the site does respond correctly over https?
If so, put the following into an htm file, as use it as a 403.4 error page.

<!-- beginning of HttpRedirect.htm file -->
 
<script type="text/javascript">
 
function redirectToHttps()
 
{
 
var httpURL = window.location.hostname+window.location.pathname;
 
var httpsURL = "https://" + httpURL ;
 
window.location = httpsURL ;
 
}
 
redirectToHttps();
 
</script>
 
<!-- end of HttpRedirect.htm file -->
0
 
jbla9028Author Commented:
So... I used the 404.3 error redirect and it did work. I ended up noticing a problem with certain people's pages and their email alerts failing though. These redirects need to be done by the alternate access mappings under the Sharepoint administration portal. If you just redirect users, alerts will fail on pages (due to a problem with the crawling of the pages by sharepoint). The redirect did work perfectly for regular websites without issues. sharepoint just sucks :)

the rewrite app also worked
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now