Please, How To Direct Single Journal To Web Root (http://journalpage.com) instead of (http://journalpage.com?index.php/ojs)

Hi Guys, wonderful work with the open source software.

I have a small issue though. I am trying to create a journal and a conference site for my fellow department students to submit materials for the journal and conference. But I have just one problem, I want to host just one journal and I want it to open directly on the web root (http://journalpage.com) instead of (http://journalpage.com?index.php/ojs. Please how do I make this happen.

I know there are a whole lot more important issues to attend to, but I’m a medical student with web design as an hobby so maybe I’m a noob (as the call it).

i have searched but truth is i dont know what i am suppose to be looking for.

1 Like

Sorry, this is going to be technical. This tends to be one of the more complicated subjects in configuring OJS. The typical solution is to use Apache’s mod_rewrite ( mod_rewrite - Apache HTTP Server Version 2.2 ) in concert with OJS’s restful_urls ( https://pkp.sfu.ca/support/forum/viewtopic.php?f=2&t=2616&start=30 ) configuration.

There are gotchas in the HOWTO’s description depending on your Apache version: http://amandine.aupetit.info/135/apache2-mod_rewrite/

We really ought to have an updated HOWTO, but the number of possible configurations makes it a bit intimidating to maintain.

The core issue, from my perspective, is that for OJS 2.x you will need two URL hooks:

  • OJS “index” or site level access
    Normally this is the site root, but you are inverting the structure to hide this root.
    This will probably be a specific URI off of your root, perhaps http://journalpage.com/index
    It would need to live in your config.inc.php as base_url['index'] = http://journalpage.com/index
  • OJS journal level access
    This is your actually main landing page
    It needs to live in your config.inc.php as base_url['SHORTNAME'] = http://journalpage.com where SHORTNAME is the Journal’s short name.

Your re-write would look something like this:

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/index/(.*)$ /index.php/index/$1 [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/SHORTNAME$1 [L]

(not actually tested)

2 Likes

This is awesome! now i know what i am actually trying to do. let me read more on this an give my feed back. Thanks

I have the same issue but I can not make sense of this solution. We have just migrate from custom web site for our journal to a OJS 2.4.8 and we are about to change the path to our DOI but I find the long URL a bit unfeasible here,

How can we drop the (index.php/aro/index) aro is the short name for our journal,

http://aro.koyauniversity.org/index.php/aro/index

and show only

http://aro.koyauniversity.org/

I have created a .htaccess file but it give server error , it reads

Options FollowSymLinks AllowOverride All RewriteEngine on RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/index/(.*)$ /index.php/aro/$1 [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/index/$1 [QSA,L]

and in the config file I provided

; journal_path of “index”.
; Examples:
base_url[index] = http://aro.koyauniversity.org/index
base_url[aro] = http://aro.koyauniversity.org/
; base_url[myOtherJournal] = http://aro.koyauniversity.org

; Generate RESTful URLs using mod_rewrite. This requires the
; rewrite directive to be enabled in your .htaccess or httpd.conf.
; See FAQ for more details.
restful_urls = Off

Thanks,

In the first re-write, you’ve taken any index (site level) request and redirected it to aro with:
RewriteRule ^/index/(.*)$ /index.php/aro/$1 [L]

In the second request, you’ve taken any request at all and redirected it to the site index with:
RewriteRule ^(.*)$ /index.php/index/$1 [QSA,L]

Re-read the untested example above. You actually want this just about the other way around.

Generally, if a request comes in, you want to direct it to “aro”. If the request comes in for the “index”, redirect it to the index handler.

Your config.inc.php base_urls look ok, but you should turn restful_urls On.

1 Like

I got this work now, We have reinstalled our server and now everything is working but the terminal link back on breadcrumbs issue, which reported as bug. Here is my code tested at

http://aro.koyauniversity.org/

In Config file

base_url[index] = http://aro.koyauniversity.org
base_url[aro] = http://aro.koyauniversity.org
restful_urls = on

and in the htaccess, please note that I needed that redirection as base domain do not work and show error, of page not found.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^aro.koyauniversity.org$
RewriteRule ^$ http://aro.koyauniversity.org/index [L,R=301]

RewriteEngine on RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/index/(.*)$ /index.php/index/$1 [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/aro/$1 [L]

indent preformatted text by 4 spaces[quote=“ctgraham, post:5, topic:827”]
^/index/(.*)$ /index.php/aro/$1 [L]
[/quote]

i just realized that i was able to get this to work and i never thanked you for it. Thank you @ctgraham

In your Site Settings (User Home → Site Administrator → Site Settings), do you have the option for “Journal Redirect” set? It sounds like you have a single-journal install and want the User Home to generally stay within that journal. As of OJS 2.4.8-1, setting this redirect will perform that operation.

Otherwise, you could change the template for templates/common/navbar.tpl manually, removing the journal="index" option from the link:

With a change like this, would your site and journal work as expected?

The site redirection has been set to ARO as this is a single journal. Shall I still do the OTHERWISE solution please?

If the site redirect is set, and you are at 2.4.8-1, and the User Home does not work as expected, there is still a problem we need to find.

If the site redirect is set, and you are at 2.4.8-0, you could either upgrade to 2.4.8-1 or apply this change here:

The override from the “Otherwise” section above will work regardless of the specific version and regardless of the settings, but is the furthest from the core code.

Yes, I just checked there is an update, Is this major task to apply the patch please?

OJS VERSION
CURRENT VERSION
2.4.8.0 (April 25, 2016 - 01:40 AM)
Latest version: 2.4.8.1 (August 3, 2016)
An updated version is available: Download | Download Patch | More Information

OJS 2.4.8 to 2.4.8-1 is a small set of fixes and enhancements. If you have performed an upgrade on your own previously, it will be a minor task. If you are not familiar with the upgrade process, it will take some extra time.

Did you do the upgrade from 2.4.7 to 2.4.8 yourself?

I have added that line to the Navbar file, What changes should expect please?

No no, I just installed fresh with 2.4.8, we just moved to OJS system, This is a newly established university journal. So I have not done any upgrading before,

If you change line 17 of templates/common/navbar.tpl from:
<li id="userHome"><a href="{url journal="index" page="user"}">{translate key="navigation.userHome"}</a></li>
to
<li id="userHome"><a href="{url page="user"}">{translate key="navigation.userHome"}</a></li>
when you click on the “User Home” link in the main navigation bar, instead of directing you to the Site’s User Home, it will direct you to the Journal’s User Home.

I expect this to resolve the first problem you describe here:

I applied this , with IF condition , So this means I need to make changes to my Cofig setting for base_url index to see if this work, am I right?

{if $isUserLoggedIn}
-	<li id="userHome"><a href="{url journal="index" page="user"}">{translate key="navigation.userHome"}</a></li>
+	<li id="userHome"><a href="{if $hasOtherJournals}{url journal="index" page="user"}{else}{url page="user"}{/if}">{translate key="navigation.userHome"}</a></li>
 		{else}

I think that change should work as-is. (I’m pretty sure the $hasOtherJournals variable is available before 2.4.8-1.)

When logged into your journal, the link should be constructed as $base_url[aro] + “/user”.

Did that work?

Yes that solved the issue with user site, and now I can add the /index to base_url[index] in config as

base_url[index] = http://aro.koyauniversity.org/index
base_url[aro] = http://aro.koyauniversity.org
restful_urls = on

but still I have to have redirection to my htaccess to make the short URL work

RewriteEngine On
RewriteCond %{HTTP_HOST} ^aro.koyauniversity.org$
RewriteRule ^$ http://aro.koyauniversity.org/index [L,R=301]

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^/index/(.*)$ /index.php/index/$1 [L]

	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ /index.php/aro/$1 [L]
</IfModule>

BTW, in the direction you have provided on MAY 15 above on the last line one have to have it should be a / after SHORTNAME to read as below, without it it does not work

RewriteRule ^(.*)$ /index.php/SHORTNAME/$1 [L]

1 Like

Hi guys
Thank you very much for these elements, but as I have the same issue, nothing proposed in the several messages on the forum is working for me.
I have freshly installed OJS 3.0.2 on an Apache Server to use it for only one journal.
My conf. :

With the solution provided in the former message, I have to many redirection

I wish there would be an easier build-in solution for single journal installations.

Thank you very much for your help.

Has anyone successfully done this on OJS3.0? By not having a clean URL, SEO ranking will be affected too. This should be a part of the design itself. Any thoughts? Feedback? Thank you.

Were you able to resolve this? We are in the same situation :frowning: