Your Development & Design Resource

basehref Shared Field: Logic Tip

Quick tip here... dealing with <base href>, and Internet Site Substitution Rules.

I'm currently, for or redirecting all traffic to the database as root-level. As such, I've set my shared basehref field (a Shared Field which is present in all that you see: More Site Mods - non-Domino-branded URLs for the backstory and What to base your links on for more information on the <base href> tag...) to simply the domain, as I'm letting Domino do the rest via the Internet Site Substitution Rules (ISSR for short).

My basehref field has the following formula:

"http://" + @GetHTTPHeader("Host") + "/"

And this is fine, as long as my ISSR do their job... but what if I hit this database with a domain that isn't configured with ISSR to substitute everything after the domain relative to the database? I get errors - 404s all day! Not good - as I might have another domain that could access a particular application or such as part of a suite, and therefore would not particularly be bound to any individual database - read: no ISSRs gang!

To alleviate such issues, I've modified my basehref field formula as appropriate:

hn := @GetHTTPHeader("Host");
@If(hn = "";"http://" + hn + "/"; "http://" + hn + "/" + @WebDbName + "/"), in this case, is my domain, or other ISSR-configured domain, and thus I can use the domain in the <base href> tag - otherwise, I defer to using the entire non-ISSR, @WebDBName-ified pathing!

This is a simple example mind you, and you can modify the above formula to include multiple ISSR-maintained domains/subdomains to ensure that your web applications are accessible via multiple domains and keep those 404s at bay!

About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.

More from is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.