OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Individual Domain Name for Each Journal within ONE OJS inst.

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

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.

Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Mon Sep 15, 2008 11:13 am

Hello,

I have set up an OJS installation and it is currently live with 6 different unrelated journals. Let's call it www.journal_engine.com

Now currently to view each individual journal you have to go to www.journal_engine.com/index.php/JOURNAL_INITIALS .

Now here are the 7 different journals I have, their abbreviation, and the domain names I have purchased for each:

Mathematics - MATH (imathj.com)
Science - SCI (isciej.com)
Computers - COMP (icompj.com)
Technology - TECH (itechj.com)
History - HIST (ihistj.com)
Radiology - RADI (iradij.com)
Forestry - FORS (iforsj.com)

So if someone wants to browse MATH, they must browse it via www.journal_engine.com/index.php/MATH
So if someone wants to browse COMP, they must browse it via www.journal_engine.com/index.php/COMP
So if someone wants to browse FORS, they must browse it via www.journal_engine.com/index.php/FORS

What I would like to do:

Browse MATH via www.imathj.com , not www.journal_engine.com/index.php/MATH
Browse COMP via www.icompj.com , not www.journal_engine.com/index.php/COMP
Browse FORS via www.iforsj.com , not www.journal_engine.com/index.php/FORS

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.
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Mon Sep 15, 2008 5:30 pm

Hi Rene,

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:
Code: Select all
<VirtualHost server.ip.address.here>
  ServerName www.domain-name-here.com
  ServerAlias domain-name-here.com
  DocumentRoot /path/to/ojs-installation
</VirtualHost>
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:
Code: Select all
RewriteEngine On
RewriteBase /

# Check for and remove "www" if necessary
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

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

# Use this set of 3 lines to allow access to the site level
RewriteCond %{SERVER_NAME} ^site-domain-here
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ 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.:
Code: Select all
base_url[journal-path-here] = http://journal-domain-here
base_url[index] = http://site-domain-here
Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Wed Sep 24, 2008 6:05 pm

Hey Alec,

Thanks a lot. I have been messing around with it.
I am not quite sure what "site-domain-here" is. Is that what I referred to as http://www.journal_engine.com in my original post?

Also, is it possible to put the contents of the .htaccess file directly into the <VirtualHost></VirtualHost> block?

Thanks a lot!
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Thu Sep 25, 2008 9:36 am

Hi therene8000,

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.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Fri Sep 26, 2008 12:19 pm

Hey Alec,

Thanks.

Here is what I have managed to do.

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

DocumentRoot
ScriptAlias
Access Log
Error 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.

Let me show you my code.

Equivalents
journal-domain-here = imathj.com
journal-path-here = MATH
site-domain-here = journal_engine.com (the centralized listing)

This went into /var/www/ojs/math.htaccess
Code: Select all
RewriteEngine On
RewriteBase /

# Check for and remove "www" if necessary
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Use this set of 3 lines for each of your journals
RewriteCond %{SERVER_NAME} ^imathj.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/MATH/$1 [L]

# Use this set of 3 lines to allow access to the site level
RewriteCond %{SERVER_NAME} ^journal_engine.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/index/$1 [L]


And this went into /var/www/ojs/config.inc.php
Code: Select all
base_url[MATH] = http://imathj.com
base_url[index] = http://journal_engine.com


Where did I go wrong?
If you want I can send you the original files/current files as well as the appropriate URLs.

Thanks a lot,
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Fri Sep 26, 2008 12:56 pm

Hi Rene,

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).

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Fri Sep 26, 2008 1:35 pm

Alec,

Thanks.

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/*
AND
you 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)?

Cheers,
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Fri Sep 26, 2008 2:51 pm

Hi Rene,

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.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Wed Oct 01, 2008 10:45 am

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

Thanks a lot!
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Wed Oct 01, 2008 11:05 am

Hi Rene,

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.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Fri Oct 10, 2008 2:14 pm

Hey Alec,

Thanks a lot! I have gotten it to work for OJS.

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).

However, as I said before - the page stays the same.

Any advice?

Cheers man!

-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Fri Oct 10, 2008 2:44 pm

Hi Rene,

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.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Sun Oct 12, 2008 4:34 pm

Hello Alec,

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 .

Cheers,
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby renec » Fri Oct 17, 2008 2:12 pm

Alec,

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).

Thanks,
-Rene
renec
 
Posts: 24
Joined: Fri Jul 04, 2008 7:49 am
Location: Athens, Georgia

Re: Individual Domain Name for Each Journal within ONE OJS inst.

Postby asmecher » Fri Oct 17, 2008 2:44 pm

Hi Rene,

Are the URLs generated by OCS looking OK? If so, that means OCS is configured properly, and it's just the rewrite rules that need work. It's probably worth looking at your Apache access logs for the rewritten URL -- IIRC, that's logged by default.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests