Accessing test1.domain shows the test1 starting page. All the style files seem to have been applied. You can access articles and also the journal backend. The only noticeable effect is that some symbols like the magnifying glass in the search bar oder the PDF-symbols in the fulltextbuttons seem to be broken:
And on the ojs journal index page which lists all available journals the css-style style is not applied so it looks blank. I checked in the site source code and the link to the css results in an 404-error
Accessing the test2 journal on the main page via http://journals.uni-giessen.de/test2 has no flaws so far. The index.php is removed from the address, all styles are found and also the icons that are broken on the test1-journal work here.
With “restful_urls” on, all URLs will be output without the index.php component for the site. Because of that, you’ll need an additional mod_rewrite rule to rewrite URLs of the form “^/index/(.*)” to /index.php/index/$1.
See this thread for cross-origin considerations in displaying the glyphicons:
At first it didn’t work. But after creating an empty folder on the filesystem level /var/www/html/ojs/index everything is fine. And the glyphicons also have recovered (magically).
It seems you are finally successful to set each journal with its own domain name.
I read the long story, but still don’t find a way to follow your method. Could you summary your method in a documentation? I think it will help a lot of people like me.
Thank you in advance
@Buyi_Li
Here is my mini HOWTO for configuring different domain names in a single OJS installation. They have been tested on Ubuntu 16.0.4 and a recent Open Suse, both running Apache 2.4.
Goal: You have a main journal platform (journals.uni-giessen.de) with some journals. The index.php in the URL should be stripped from all journals. Some of your journals are fine with staying on your main journal page. Others want to have their own domain (rmm-journal.de).
OJS is installed in /var/www/html/ojs
Activate the apache rewrite mod
Set up you apache hosts
For the main journal platform:
<VirtualHost *:80>
<Directory /var/www/html/ojs>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName journals.uni-giessen.de
DocumentRoot /var/www/html/ojs
</VirtualHost>
For the journal that wants its own domain:
<VirtualHost *:80>
<Directory /var/www/html/ojs>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerName rmm-journal.de
DocumentRoot /var/www/html/ojs
</VirtualHost>
The options in in directory clause are important. You also have to consider the servernames with www and port 443 configuration. For better overview i stripped this from the example
Create an empty directory “index” in the ojs directory on the filesystem level /var/www/html/ojs/index I had to do this so that the OJS mainsite (with all the journals available on this ojs installation) works well with the rewrite rule.
Our OJS in not live yet but so far everything seems to be fine this way.
Watch out how your journal statistics start to work. We noticed that with when we had a subdomain defined for journal1 and an ordinary domain for journal2, it was not enough to define base_url[journal1]. We also had to define base_url[journal2] and set the default journal url there. See Usage stats warnings: system can't remove the base url
So does this mean if you have, say 5 journals, journal[1-5] and journal1 is on a different domain but all others are on the same domain you still need to set up 5 base_url[journal[1-5]]?
Unfortunately, to prevent this, you will need to add re-write conditions to exclude each URL form which you want to block. If you were using RESTful URLs, you might be able to simply block direct access to index.php so that all traffic would have to go through your approved re-writes. Barring that, you will need an additional rule to check something like:
I also wanted to test to activate restful_urls in “config.inc.php” file.
But I doesn’t seem to block direct access to index.php :
NOK: Home page of OJS portal: https://openhomeportal.org/journals: display the home page of OJS journal with the list of all journals but there is a problem of css:
/journals/index/$$$call$$$/page/page/css was not found on this server
Do I have to add other rules in “htaccess” file to make RESTful URLs work ?
What is the use of RESTful URLs except to block direct access to index.php ?
Thanks again for your precious help.
Kind regards.
Helene
I have configured my OJS for multiple journals (only one at the moment) in OJS 2.4.8 with base_url[JNAME] = http://JNAME.ucc.ie
and Apache as suggested, with a VH for the JNAME serving from /var/www/html/ojs and your rewrite rules (for which many thanks). I commented out the two conditions for Apache <2.2 as we’re on 2.2.15, and added three lines in their place:
It’s all working well except for a couple of URIs.
If I log into JNAME with an author login, I correctly get the page http://JNAME.ucc.ie/user and it all looks fine, but the links behind “User Home” and “My Journals” both go to http://SERVER.ucc.ie/ojs/user which is 404. I assume this link ought to be http://JNAME.ucc.ie/user but I don’t know if this is due to some internal OJS config, or something I should trap in the rewrite rules (and I’m not clear how).
I have obviously done something wrong, but what? I certainly used to be able to login as admin (ie the link worked) and I’m not aware of changing anything that would stop it. What is the real login URI?
This ties two Rewrite Conditions to the first Rewrite Rule, and leaves the second RewriteRule with no Rewrite Conditions. I think you want the second Rewrite Rule to be conditional on the SERVER_NAME of journal1.org as well (unless this is a final catch-all after all journal-specific traffic has been handled).
Regarding the user home, this is a longstanding difference of opinion within the project regarding whether the user home should direct to the Site, or whether the user home should direct to the current Journal. See: https://pkp.sfu.ca/bugzilla/bugslist/show_bug.cgi?id=8802
The current 2.4.8 code tries to detect whether the user has access to multiple journals within the site, and send the user to the Site if that is the case:
I have preferred to always default to the Journal’s User Home:
Thanks very much. I agree it should default to the journal user’s home, not the OJS installation.
I’m not clear what to do with the extra rule, though. I should have made it clear that this server is serving dozens of applications, not just OJS, and right now, this journal is the only cname using Rewrite, so all the rules are inside the Apache VH block for that cname.
To my mind, as the problem arises with http://SERVER.ucc.ie/ojs/user, not http://JNAME.ucc.ie/ojs/user, I would need to add this rule at the top level of httpd.conf, outside any virtual host blocks, and it could then be hardwired to catch this specific instance…which of course won’t work when there are multiple journals, because how will it know which one to go to when there is no trace of a journal name in the incoming URI?