Your Development & Design Resource
Cleaner URLs via IBM Lotus Domino URL Substitution Rules and BASE HREF
08/11/2010 08:35 AM by Chris Toohey
This site - dominoGuru.com - runs on IBM Lotus Notes Domino... but you wouldn't know that from the URL. This quick tip highlights the technique of using Domino URL Substitution Rules for domain-specific Internet Site Documents to create cleaner URLs while still maintaining Domino NotesData Domino URL Command functionality.
Let's say your NotesDatabase is located on your Domino server in two subdirectories off of the root/Data directory:
Our first step is to create an Internet Site Document for the incoming domain. Simple create a new Internet Site Document (after first making sure that your Domino server is setup to use Internet Site Documents...) with the following information:
|Host names or addresses mapped to this site:
If you do nothing more than this, hitting dominoguru.com (or www.dominoguru.com) will work. It will consume the HTTP Request, and launch the NotesDatabase with the following URL address:
Now, if you're using the standard Domino URL formatting, you can get away with making every URL-based link relative to the Domino-generated base URL. The problem with this technique however is that when moving between the Form/View/Page and the NotesDocument levels in the URL the Domino-generated base URL changes.
When you're on a Form/View/Page, the base URL is the NotesDatabase which means a call to image.gif actually points to:
This breaks when you load a NotesDocument via URL, as the base URL shifts from the NotesDatabase to the View:
Of course, you could create a relative URL to the given resource -- instead
/image.gif -- but
this actually makes the base URL the Domino Server... which is by design, as
you could easily use the HTML subdirectory to store your common images,
But to use a native resource to the NotesDatabase, you have to use some developer-Fu and add a Computed Text instance in front of the URL linked resource:
<img src="<Computed Text>image.gif"
Where your Computed Text is the following:
Some Domino Developers have recommended adding a Base HREF tag in the HTML Header with the following formula:
... where the <Computed Text> Formula is the same Formula as the Computed Text example above.
Using this technique, you can simply refer to image.gif, or screen.css or FormName or ViewName or even ViewName/NotesDocument via URL, and the browser client will use the NotesDatabase as the root location.
... but this still gives you Domino-generated URLs.
And that's where the Internet Site Document Substitution Rules save the day!
You simply create Substitution Rules for your Internet Site Document, making any inbound URL /* point to /<dir1>/<dir2>/index.nsf/*.
You then simplify your Base HREF:
<img src="image.gif" /> from
http://dominoguru.com actually points to http://dominoguru.com/
<dir1>/<dir2>/index.nsf/image.gif... but the URL address is
This technique also allows you to move your NotesDatabase to another server or change the directory structure without breaking all of your search engine indexed and external hand-written URLs... aiding your Domino environment administration as well as your ability to maintain content availability.