As the developers of Open Journal Systems, Open Conference Systems, Open Harvester Systems, and Open Monograph Press, the PKP team are experts in helping journal managers and conference organizers make the most of their online publishing projects. PKP Publishing Services offers support for:

As a customer of PKP Publishing Services, you will not only receive direct, personalized support from the PKP Development Team, but will be contributing to the ongoing development of the PKP applications. All funds raised by PKP Publishing Services go directly toward enhancing our free, open source software. For more information, please contact us.

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

After doing a little bit of research, I think that mod_rewrite might be the correct plugin to use for Apache. But otherwise can that be done?

Also - when specifying the document root, script alias, and logs for each journal - how is that done (vhost directives: DocumentRoot, ScriptAlias, ErrorLog & CustomLog)? Is it possible to have a separate vhost for every journal?

Maybe I have been approaching this from the wrong side? Could somebody help me out with this? I would greatly appreciate it! Best Regards!

-Rene

*Please note that I just made up the names of the journals and domains to help my question.

This is a tricky subject, so I'll go through it step by step. I'd recommend getting your own setup working piece by piece along these lines, since it'll be tough to debug if you try to tackle it all at once. A lot of this is Apache configuration, for which the details are better discussed on an Apache forum, but I'll do my best to give an overview here.

There are basically two steps to getting the URL rewritten:

Getting incoming requests mapped into OJS, and

Getting OJS to generate the right URLs in the responses it makes to those requests.

The first part involves configuring Apache (e.g. virtual hosting and mod_rewrite); the second part involves configuring OJS (and OJS tries to automatically detect some of this, so depending on how picky you are about URLs, you may not need to configure OJS at all).

The first thing to do will be to configure your virtual hosting. We use something like:

If you create an entry for each domain, you should now be able to access your OJS install using your domain names. Get this working first.

There are two problems that can now be solved with mod_rewrite:

You can access all journals from all domains, i.e. while you can access journal1 from http://www.journal1.com/index.php/journal1 (good), you can also access journal2 from http://www.journal1.com/index.php/journal2 (bad).

There is redundancy in the URL, i.e. in http://www.journal1.com/index.php/journal1, the index.php and /journal1 parts are unnecessary.

Make sure your server allows .htaccess overrides, or else the following part won't have any effect.

In the OJS installation directory, create a .htaccess file with the following contents:

# Use this set of 3 lines for each of your journalsRewriteCond %{SERVER_NAME} ^journal-domain-hereRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/journal-path-here/$1 [L]

# Use this set of 3 lines to allow access to the site levelRewriteCond %{SERVER_NAME} ^site-domain-hereRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ index.php/index/$1 [L]

...replacing "journal-domain-here" with the journal's domain name (e.g. "journal1.com"), journal-path-here with the path you used in the OJS "create journal" dialog box (e.g. "demo"), and "site-domain-here" with the domain name you're using to access site-level content (e.g. the Site Administrator's interface).

Now configure OJS so that it knows to use these URLs. Edit your configuration file, and in the "general" section, add a base_url[index] setting and a base_url[...] setting for each of your journal paths, e.g.:

You may have a separate domain for each one of your journals, but you'll also need some way of accessing the site-wide content (i.e. the site portal, which lists all journals for users to browse, and important pages like the Site Administrator's interface that aren't associated with a particular journal). This would typically be somewhere in the library's domain if you're hosting in a library.

Firstly I configured two virtual hosts. They include the following directives:

DocumentRootScriptAliasAccess LogError Log

Is it okay for each journal to share the access logs and cgi-bin directories? (i.e. to specify the same folders/file and folder for error/access log and ScriptAlias - I know they will all use the same DocumentRoot).

The first vhost I made was up and runing before this. It took you to what I call, the "journal engine". It hosts all of the journals - and has them in a listing which you can browse through. So the vhost for this was/is working fine.

I quickly made another vhost for a journal. After that I pointed a DNS at it. So I could access the "journal engine" via the domain name that I planned to use for a journal - as well as the domain name that I originally used for the "journal engine".

Next I went to /etc/apache2/apache2.conf and changed "AllowOverride None" to "AllowOverride All". After this I went to the OJS directory.

In the OJS directory I first created a XXXX.htaccess file (with XXXX being the journal's path - just so I knew which one it referred to). Then I went and added the base_url directive in the config.inc.php file in the /var/www/ojs/config.inc.php file.

Anyhow - after doing all this I made progress, however it does not work right. When I type in the URL that I want to use for the JOURNAL - it takes me to the journal engine (centralized listing). However it maintains the correct domain name throughtout browsing the website - which should be possible with just a vhost though. BUT - I noticed when you click on "View Journal" with the abbreviation that you used in the .htaccess file, it just keeps reloading the journal engine page. You can browse any other journal fine.

Unfortunately we're not going to be able to help you much on the specifics, as each configuration is different and mod_rewrite tends to be tricky... however, are you sure your .htaccess file is getting picked up? I've never seen a situation where the .htaccess file is named something different (math.htaccess in your case).

I got it to work. I just had to put an "AccessFileName .htaccess-imathj.com" directive into the VirtualHost.

Then I decided to change the math.htaccess file name .htaccess-imathj.com and it worked.

**************************However,

There is still the redundancy issue. When you click on somewhere it reverts back to imathj.com/index/php/MATH/*ANDyou can still access COMP (computational journal) via imathj.com/index.php/COMP Will this be fixed by making the .htaccess files for the other domain names?

Also - don't search engines penalize for having multiple VirtualHosts point at the same directory (DocumentRoot)?

It sounds to me like your rewrite rules aren't working fully; the problem you're having (redundancy in the URLs and the ability to access one journal from another's domain) is described in http://pkp.sfu.ca/support/forum/viewtopic.php?p=13276#p13276. The rules there should take care of it, though I'm not sure OTOH where you're diverging from those.

Okay. Seems like I have gotten it mostly to work. I have only enable one so far.

There are some little issues.

so imathj.com displays stuff without the index.php. i.e. imathj.com/reader - the rewrite rules successfully get rid of the index.php. However I can still access COMP via imathj.com/index.php/COMP. Maybe this is because I have not yet specified the rewrite rules for COMP?

Also - I cannot access the Administrators panel when I have the mod_rewrite directives enabled. What do you think that this is due to?

I actually noted that it works when I comment the base_url directives I added to the config.inc.php

Yes, you'll need to add rewrite rules that specify each journal individually. (The list of rules above, including "RewriteRule ^(.*)$ index.php/MATH/$1 [L]", looks OTOH like it should be OK.) This means that you'll also need to add an entry to use for the admin control panel, where the part after the index.php part of the URL will be "index" (rather than a specific journal path). This is the "site-wide content" that I was talking about at http://pkp.sfu.ca/support/forum/viewtopic.php?p=13455#p13455.

By the way, can these same rules be applied to OCS? I tried that and got them to - eh, work...somewhat. All the redundancy etc. is gone, but when you click on a link - the page stays the same. The URL however, changes to adapt to whatever you clicked on (i.e. clicking on register takes you to newdomain.com/register and not newdomain.com/index.php/ND/register).

The only difference between OJS and OCS is that there are two levels of "context" -- in OJS, you only had the journal path (or "index" for site-level stuff); in OCS, there is the conference and scheduled conference (e.g. "pkp" and "2009" for the 2009 PKP Conference). Off the top of my head, the same rules should work; however, I can't recall using rewrite rules to get rid of the index.php part in the case of OCS, so there might be a few tweaks. Let me know if you can't get it working and I'll run a couple quick tests to make sure everything's OK on the OCS side of things.

I understand what you are saying about the Conference -> Scheduled Conference thing. Yes - however, if you just wanted it to point to example.com/index.php/CON instead of example.com/index.php/CON/SC , would it be alright to use the same rewrite rules?

That's what I though, however it did not work out as well as I had hoped. I was trying to point at the conference homepage (not at the scheduled conference homepage).

I'll look into that mod_rewrite documentation, although its still "voodoo" ;D .

Okay. I have messed around with this a lot. I can never get it to work 100% . Whenever I try something, one part works but another does not. Most notably I got the rewrite working for the conference page (i.e. it beautifully rewrote Announcements, Login, etc. on the conference page) - but when you click on the recent scheduled conference it would go nowhere (the page would stay the same).