Creating URL Redirects from the Web

If you've ever needed a way to allow developers access to create their own URL redirects from the Web, here's a quick and dirty solution.

I created a form that mirrors the mapping form in Domino Administrator. After authenticating, the developer has a drop down list of the servers in which they can create redirects. I use JavaScript to validate the fields and from an onClick event, I run an agent that creates a response doc to the server doc called "Mapping". I get a handle to the "WebConfigurations" view in the NAB and a handle to the server doc where I want to add the redirect.

In order for these changes to take effect, I created two program documents to stop and start HTTP overnight. Otherwise, the developer can contact me immediately to determine when I can stop/start HTTP.

Here are the parameters for the program documents:
Program name: nserver
Command line: -c "tell http quit"
Server to run on: <BR> Comments: quits http task </P> <P> Program name: nserver<BR> Command line: -c "load http"<BR> Server to run on: <Server Name><BR> Comments: starts http task </P> <P> Remember to enable the program and select a time to run each document. I found setting them to run within a minute of each other works best. </P> <BR><P> <PRE> Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim doc As NotesDocument Dim redirectDoc As NotesDocument Dim webDoc As NotesDocument Set webDoc = session.documentcontext Set db = New NotesDatabase("","names.nsf") Set view = db.GetView("WebConfigurations") Set doc = view.GetDocumentByKey("<Server Name>") Set redirectDoc = db.CreateDocument Call redirectDoc.MakeResponse(doc) redirectDoc.Form = "Mapping" redirectDoc.ServerName = webDoc.ServerName(0) redirectDoc.MappingType = "3" 'URL -> Redirection URL redirectDoc.MapType = "Redirect" redirectDoc.Type = "Mapping" redirectDoc.RM_MapFrom = webDoc.MapFrom(0) 'incoming URL string redirectDoc.RM_MapTo = webDoc.MapTo(0) 'redirection URL string Call redirectDoc.Save(True,True) End Sub </PRE> </P></body></html>

This was first published in March 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.