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.

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby asmecher » Fri Jul 26, 2013 4:23 pm

Hi Anna,

Have you configured your installation to redirect to your single journal? (This is an option on the Site Settings page.) If you have, then base_url[index] will not be what you're looking for -- it'll be base_url[journalPath], where "journalPath" is the journal path from the Site Administrator's settings page for that journal.

Incidentally, it's not entirely clear to me from your first post whether you're talking about the way URLs are rewritten by Apache on their way to OJS, or whether you mean the URLs that are generated by OJS and sent back to the user. Which kind is getting generated incorrectly? (My suggestions to tinker with config.inc.php will affect the URLs OJS generates, but not of course how Apache rewrites those URLs when it receives requests and forwards them along to PHP.)

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

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby annajonna » Thu Aug 01, 2013 4:54 am

asmecher wrote:Hi Anna,

Have you configured your installation to redirect to your single journal? (This is an option on the Site Settings page.) If you have, then base_url[index] will not be what you're looking for -- it'll be base_url[journalPath], where "journalPath" is the journal path from the Site Administrator's settings page for that journal.

Incidentally, it's not entirely clear to me from your first post whether you're talking about the way URLs are rewritten by Apache on their way to OJS, or whether you mean the URLs that are generated by OJS and sent back to the user. Which kind is getting generated incorrectly? (My suggestions to tinker with config.inc.php will affect the URLs OJS generates, but not of course how Apache rewrites those URLs when it receives requests and forwards them along to PHP.)

Regards,
Alec Smecher
Public Knowledge Project Team


Hi Alec, I had tested confinguring for a single journal but could not get that to work either, so I backed out of that an went for what I really wanted to do. Thanks for the explanation of how this all works, I needed to understand how this works and your text explains very clearly how the rewrite works in OJS so I figured out that the problems were in the rewrite code. So I started debugging.

The method was to turn on Rewrite Logging in the Apache virtual server config like so:
Code: Select all
    <IfModule mod_rewrite.c>
        RewriteLog "/var/log/ojs/logs/rewrite.log"
        RewriteLogLevel 1
    </IfModule>

Then change the inde.php file so that the beginning reads:
Code: Select all
<?php
var_dump($_SERVER);


Along with this I was tweaking a few settings in config.inc.php:
Code: Select all
[general]
base_url = "https://ojs.hi.is"
disable_path_info = On
allow_url_fopen = Off
base_url[index] = "https://ojs.hi.is"
base_url[irpa] = "http://irpa.is"
restful_urls = On


I noted that many things worked when disable_path_info = On . By commenting it out and debugging some more, I found that the _SERVER["PATH_INFO"] variable was missing on some pages and in some rewrite situations. So I changed index.php like so:
Code: Select all
<?php
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
var_dump($_SERVER);


After this change, everything worked, and some work remains to be done to clarify the reasons for this. It may have to do with the facth that we are using Nginx as a front end load balancer for a cluster of Apache servers. Maybe the PATH_INFO variable somehow gets lost there. Anyway the scholars are happy now that their Open Journal System mostly works as it should. :)

Many thanks for your help and explanations,
Anna Jonna Armannsdottir <annaj@hi.is>
University of Iceland Computing Services
annajonna
 
Posts: 3
Joined: Fri Jul 26, 2013 8:05 am

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby asmecher » Thu Aug 01, 2013 7:35 am

Hi Anna,

Thanks for following up with the details. I haven't worked with one of these environments myself, but it seems that some CGI or PHP configurations present data in "ORIG_PATH_INFO" but not in the standard "PATH_INFO" variable. There's a little bit of (inconclusive) detail at http://stackoverflow.com/questions/5629683/serverpath-info-and-serverporig-path-info-in-php.

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

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby albertosa » Thu Dec 04, 2014 9:31 am

Dear OJS community,

I tried to implement a DNS for a particular journal within ONE OJS install. I followed the instructions on this thread but unfortunately without perfect results. Maybe because our server runs in a Windows environment, I had to slightly change the code to manage one solution that runs apparently well, but with some malfunctions as I’ll describe below.

Therefore, I’m asking for your kindly support to help me solve the problems which I heartily thank in advance ;-)

Our system:
OJS v2.4.2.0; PHP v5.2.6; Apache 2.2.8; PostgreSQL 8.3; Windows Server 2003 SP2.

Apache > conf > vhost.conf
Code: Select all
<VirtualHost internal_IP:port>
ServerName www.myjournal_ownDNS.com
ServerAlias myjournal_ownDNS.com
DocumentRoot “<internal_path>/htdocs/ojs"
<Directory “<internal_path>/htdocs/ojs">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride ALL
      Order allow,deny
      allow from all
</Directory>
ServerAdmin name@email.com   
ErrorLog "logs/myjournal_ownDNS-error_2.log"
CustomLog "logs/myjournal_ownDNS-access_2.log" common
</VirtualHost>


Apache > htdocs > .htaccess
# START OJS
RewriteEngine On
RewriteBase /

# Rules for journal “myjournal” in an OJS installed as "www.old_URL.com/ojs/"
RewriteRule ^myjournal$ myjournal/
RewriteRule ^myjournal/(.*)$ http://www.old_URL.com/ojs/index.php/myjournal/$1 [L,QSA]
RewriteRule ^www.old_URL.com/ojs/myjournal/(.*)$ http://www.old_URL.com/ojs/index.php/myjournal/$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^www.old_URL.com/ojs/(.*)$ http://www.old_URL.com/ojs/index.php/index/$1 [L]
# END OJS


Apache > htdocs > index.php
Code: Select all
<?php
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
var_dump($_SERVER);


Apache > htdocs > ojs > .htaccess
Code: Select all
RewriteEngine On
RewriteBase /

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} ^myjournal_ownDNS\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?journal=myjournal/$1 [L]

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


Apache > htdocs > ojs > config.inc.php
Code: Select all
[general]
base_url[myjournal] = http://myjournal_ownDNS.com/index.php?journal=myjournal
session_cookie_path = /
disable_path_info = On
allow_url_fopen = Off
base_url[index] = http://myjournal_ownDNS.com/index.php?journal=myjournal
restful_urls = On


So far, I've noticed this problems:
1. URL length
To view table of contents' page I get this strange URL:
http://myjournal_ownDNS.com/index.php?journal=comsoc&page=issue&op=view&path%5B%5D=148&path%5B%5D=showToc

This is not quite a problem but I wonder if there is a simpler way to represent the URL.

2. “Create New Issue” problem
With the above configuration I can’t add a new issue - somehow, even if the form is completed filled in, I got an error message pointing to blank fields, which is not true.

3.
I cant’t access OJS system administration' page at all.

4.
Clicking in ‘User Home’ within other journal page, it always drive me to ‘myjournal’ user home page. It means that I can’t access ‘user home’ page for each other journals without redirecting to this address:
http://myjournal_ownDNS.com/index.php?journal=myjournal&page=user

Many thanks,
alberto
albertosa
 
Posts: 27
Joined: Fri Jul 04, 2008 9:09 am
Location: Guimarães/Braga - Portugal

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby asmecher » Thu Dec 04, 2014 9:35 am

Hi Alberto,

1. These URLs are being generated in place of shorter/nicer URLs using PATH_INFO because you've turned on disable_path_info in your config.inc.php.

2. I'd suggest checking whether you've got a mod_security rule or something intervening. If you're not connecting to the server directly, try that, in order to eliminate the possibility of an upstream filter or firewall; also check the server itself to see if a mod_security rule or similar is getting triggered.

3. This is the base_url[index] setting, probably. If you can work on #1 (turning disable_path_info back off and going back to "nice" URLs) it'll probably fall in.

4. This is bug #8224 and a cluster of related reports. Basically, there isn't a good solution to the current structure of the user home that'll satisfy all users; we've gone back and forth, each time making part of our user community unhappy. We have a better structure for OJS 3.0 but in the meantime I'd suggest reading the discussion on that bug and possibly tweaking your user home link to suit.

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

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby albertosa » Fri Dec 05, 2014 8:43 am

Thanks, Alec!

I made some tweaks following your tips that solved almost all problems:

In config.inc.php I needed to change not one but two settings (put 'Off' instead of 'On'):
Code: Select all
disable_path_info = Off
restful_urls = Off

Because of this, the URL’s changed a little bit so an update was needed in OJS' .htaccess (I only present the changed lines, please see above for the complete script):

Apache > htdocs > ojs > .htaccess
# RewriteRule ^(.*)$ index.php?journal=myjournal/$1 [L]
RewriteRule ^(.*)$ index.php/myjournal/$1 [L]

The problems #1, #2 and #3 were solved, but problem #4 remained as it is declared a bug. Nevertheless, it is much better now :-)

Now, I got this URL structure for the current issue, for example:
http://myjournal_ownDNS.com/index.php/myjournal/issue/current

Is there something I could do to simplify it a little bit more? For example, it seems redundant the segment "/index.php/myjournal/".

Thanks again,
alberto
albertosa
 
Posts: 27
Joined: Fri Jul 04, 2008 9:09 am
Location: Guimarães/Braga - Portugal

Re: Individual Domain Name for Each Journal within ONE OJS i

Postby asmecher » Fri Dec 05, 2014 9:31 am

Hi Alberto,

To hide the index.php part of the URL, you'll need the RESTful URLs setting, but you'll need to include the index.php part in your mod_rewrite rules; see docs/FAQ for some details on this.

To go one step further and hide the journal path, you'll need to include the journal path in the rewrite URLs as well, and use the base_url[journal_path_here] configuration directive to get OJS to generate URLs accordingly. Note that OJS will still need separate spaces for journal-related URLs (base_url[journal_path_here]) and site-related URLs (base_url[index]) such as Site Administration etc.

I'd suggest tackling these separately, in the above order -- with mod_rewrite it's easy to get tangled up. Note that there are two symmetrical sides to this -- mod_rewrite, which mangles the URLs and passes them on to OJS, and the OJS configuration, which generates outgoing URLs. The two aspects will need to match.

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

Previous

Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests