Koha How-To

Why Koha needs the OPACBaseURL

I had an odd ticket cross my desk today. Once I had determined the cause of the problem, I was frankly surprised I had not seen this issue before. But still, it’s odd enough, and easy enough to fix, that I thought I would share it.

Basically the issue was this: The librarian used the ‘Share by email’ link from the detailed record display in Koha to send a link to a patron. However, the link in the email came through looking like this:

http: / / / cgi-bin/koha/opac-detail.pl?biblionumber=12345

[Note – I’ve deliberately broken the link so that it is not clickable. In the “real” link, there were no spaces.]

Notice that the actual catalog hostname is missing. This is due to Koha’s OPACBaseURL system preference not being filled in. This is a very easy problem to fix. Go the staff client, and either do a search on system preferences for ‘baseurl’, or go to Home > Administration > System preferences > OPAC, and look for the syspref. Fill it in with just the hostname of your public catalog; do not include the beginning http:// or the ending /. Save and you’re done.

So what happens without this syspref? Well in most mail clients, they should recognize that this isn’t a valid URL, and thus won’t make it clickable, or only make part of it clickable, which should result in a server not found message. However, some mail clients will just go ahead and make the entire link clickable, and that’s the problem.

Since there isn’t a complete hostname here, the browser thinks ‘cgi-bin’ is the hostname, and thus will try to send the user to ‘h t t p : / / cgi-bin dot com’. (Again, spaces inserted for safety.) I’m making no evaluative statements here, but safe to say you probably don’t want to send your users there.

So, make sure you fill in that OPACBaseURL system preference.

Thanks for Sarah W. for bringing this ticket to our attention and be sure to check out Nicole’s post from last year on this very topic for more information about the OPACBaseURL preference.