Best practices for SharePoint URL / Redirect

My employer uses MOSS 2007 for our company intranet. It works exclusively on secure http, and is also available to the outside world through ISA. I currently have a request to add a forwarding URL to our site so that the following happens:

intranet.mycompany.com/vanityname
redirects to -> intranet.mycompany.com/somedeeplink/default.aspx

I fully expect that over time all this will become more popular among our users. So I'm looking for a solution that scales. I have read various articles on creating meta / forwarding tags or / redirecting a SharePoint page. I also saw some that talk about adding virtual directories, etc. Directly in IIS. All of these solutions seem overkill and inevitably take up more memory or processing time on web servers.

I am currently leaning towards writing an http module that can be configured in web.config and redirected. I wanted feedback to find out if anyone else had done something similar in SharePoint 2007 and any suggestions. Again, I would like to implement something that scales, without making big changes later, and imposes a minimal processing load on our web servers. Thanks!

+4
source share
5 answers

Ive implemented URL redirection using MOSS using the HTTP module route. I documented the code I used and which parameters worked best for me here;

http://scaredpanda.com/2008/08/url-rewriting-with-sharepoint-moss-2007/

Take a look and let me know if this helps you and if you have any questions.

Update:. The link above is no longer valid, so here is the text from the page that I used to redirect the URL.

After a little busting, I came up with a good way to do this. When I searched for examples on the Internet, there were many people who said that this was impossible to do. But in the end, in fact, this was not required. Heres the HttpModule that I wrote to do this job.

The keys are this.app.BeginRequest + = new EventHandler (app_BeginRequest), which steps before the request and allows the module to redirect it.

And HttpContext.Current.RewritePath (redirect, false); will click the desired n headers so that the receiving .aspx page understands how to send the message correctly.

using System; using System.Data; using System.Data.SqlClient; using System.Reflection; using System.Collections; using System.Text; using System.Web; using System.Web.Caching; using System.Web.SessionState; using System.Security.Cryptography; using System.Configuration; using System.Threading; using System.IO; using System.Security; using System.Security.Principal; namespace ScaredPanda { public sealed class RewriteHttpModule : IHttpModule { HttpApplication app = null; /// /// Initializes the httpmodule /// public void Init(HttpApplication httpapp) { this.app = httpapp; this.app.BeginRequest += new EventHandler(app_BeginRequest); } public void app_BeginRequest(Object s, EventArgs e) { try { //determine if the income request is a url that we wish to rewrite. //in this case we are looking for an extension-less request string url = HttpContext.Current.Request.RawUrl.Trim(); if (url != string.Empty && url != "/" && !url.EndsWith("/pages") && !url.Contains(".aspx") && url.IndexOf("/", 1) == -1) { //this will build out the the new url that the user is redirected //to ie pandas.aspx?pandaID=123 string redirect = ReturnRedirectUrl(url.Replace("/", "")); //if you do a HttpContext.Current.RewritePath without the 'false' parameter, //the receiving sharepoint page will not handle post backs correctly //this is extremely useful in situations where users/admins will be doing a //'site actions' event HttpContext.Current.RewritePath(redirect, false); } } catch (Exception ex) { //rubbish } } } } 
+3
source

Have you studied alternative access mappings?

http://technet.microsoft.com/en-us/library/cc263208.aspx

+2
source

If you are willing to pay for the decision. Take a look:

NOT FOR FREE → http://www.muhimbi.com/Products/SharePoint-URL-Shortener.aspx

+1
source

Depending on the number of redirects, you can implement an HTTP module as indicated), but what about checking

FREE → http://www.codeplex.com/sharepointsmart404

0
source

Use the URL Rewrite function in IIS. (I believe the extension is IIS 7)

http://www.iis.net/download/urlrewrite

0
source

All Articles