Documentation on base_url setting

I have been looking at some posts in the forum regarding the base_url settings and I tried looking for information with a web search engine in the documentation (search string “base_url site:docs.pkp.sfu.ca”). Both to no avail.

  • OJS 3.2.1-3
  • It is unclear when and where the base_url settings are used, specifically the journal-specific-settings with base_url[slug]

Currently we keep defining base_url[slug] for each and every journal we have, but I get the feeling this might not even be necessary? I failed in my search of when and how this setting is relevant. I suspect that in a multi-journal settings where some journals have their own domain, these might need the setting, but without any documentation it is hard to tell. Also our settings look something like this:

base_url[slug] = https://www.example.com/index.php/slug/

This did not lead to any issues so far, but I don’t think this is the intended use of this setting.

Could someone point me to where in the documentation I can find more information on base_url and/or elaborate on it? The two or three sentences in the config.inc.php file itself do not suffice.

Disclaimer: I did not have a look at the video tutorials.
(Gabriele)

Hi @ojs_univie,

If you look at this post here: OJS with multiple domains error - #6 by primozs - you can get a sense of how they have their base_url - it shouldn’t include the index.php like you have it. But if you are just using one domain name as your journal name instance, then it should fine to just use one in the base_url setting.

-Roger
PKP Team

Hi @rcgillis ,
thanks for your reply! I did have a look at that thread. But I am still a bit underwhelmed that this setting gets only two lines of comments in the config.inc.php for documentation and that’s just it? I have no idea if and when this setting comes into play. Obviously we have been using it wrong for years now and it did not make any difference. Do I need to define it for each and every journal or only those that have their own custom domain? As far as I know we don’t use any proxy, which is mentioned in the comment in config.inc.php. So maybe we don’t need it at all if it has been wrong for so long now?
(Gabriele)

Hi @ojs_univie

This is probably one of the most important settings in your config.inc.php that impacts ojs core, but also in plugins, libraries, theming, etc. and is also a usual subject in the support forum.

I agree with you that base_url needs more explanation and I’m sure it will be improved soon.
Thanks to make it notice.

Till this is done, let me share with you what I found about this tricky variable, even I’m not a pkp developer (so this could be partial or even wrong):

  • If you don’t set this variable, OJS will try to discover this info by it’s own. This could work fine (it usually does it great in standard installations) or not as fine (if you are behind a proxy, or in a virtualization/containerization or with complex mod_rewrite rules).
  • If you set this variable, you are forcing OJS to take the value you set for:
    • base_url: is the cannonical base url of your site (ie: used by libraries to buid it’s own path).
    • base_url[index]: is the url of your OJS home page (as far as OJS can host multiple journals in a single installation and include general administration pages).
    • base_url[journalTag]: is the url of your journal’s home (used by ojs to build journal’s relative paths).

If you set your OJS installation to work with restful urls (“clean urls” in other CMSs) those paths don’t need the index.php.

So… answering your question, I personally think is better setting this variable instead of letting OJS trying to guess, but this is up to you.

You can learn more about this variable in the gitHub issues of the project:

Cheers,
m.

Thanks, @marc for weighing in with this helpful advice. And, @ojs_univie, I’ve flagged this issue on our documentation hub: Provide better documentation on the use of `base_url` in the config.inc.php file · Issue #703 · pkp/pkp-docs · GitHub, in order that we can hopefully provide better documentation and more thorough explanations on the base_url settings in the future. Feel free to weigh in on this issue in Github if you’d like.

-Roger
PKP Team

2 Likes

Roger that! :stuck_out_tongue:

(you will probably tired of this stupid joke… are you? :sweat_smile:)

1 Like

This topic was automatically closed after 6 days. New replies are no longer allowed.