dominoGuru.com
Your Development & Design Resource
basehref Shared Field: Logic Tip
03/04/2006 12:18 AM by Chris Toohey
Quick tip here... dealing with <base href>
, and Internet
Site Substitution Rules.
I'm currently, for www.dominoguru.com or dominoguru.com 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 = "subdomain.serverdomain.net";"http://" + hn + "/"; "http://" + hn +
"/" + @WebDbName + "/")
subdomain.serverdomain.net, 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!