Single journal url .htaccess configuration

What specific version of OJS are you using (including the last “dot release”)? When you tried a clean install on localhost, did you have the installer create a new database, or did you already have a database?

I’m using 3.0.1. Oh yes, about that, I could not create a new database and the installation could not proceed. I just did the installation in localhost yet again to make sure. And now I remember that I’ve been getting “A database error has occurred: Access denied for user…”
Only way I could resolve it was create a new database in phpmyadmin in hostgator cpanel and then created a new user and elevated its privileges to that database. And then I entered the database and the user to the OJS Installation and OJS installation was successful… hmmm… Could this be the reason?

I would be primarily concerned about installing “over top” of an existing database. If you have a blank database created in phpmyadmin which the OJS install populates, or if you have the installer create the database, I would expect the user your specify in the installation form to get full admin privileges.

I replicated the problem of the Site Settings not displaying in 3.0.1 and 3.0.2. I was able (in 3.0.2) to manually enter the URL of “index.php/index/admin/settings” and to pull up and to save the Site Settings as the administrator. Manual access to index.php/index/admin/settings is inconclusive. I’ve found the Site Settings will only show if more than one journal is defined. I’m going to gather a bit more information and then file a bug report.

Do you have an Apache DirectoryIndex directive which applies a priority to anything over index.php? I had:
DirectoryIndex index.html index.php
and this caused PHP’s PATH_INFO to be malformed under mod_rewrite.

Changing this to DirectoryIndex index.php allowed OJS to behave as expected, with the Site index automatically redirecting to the Journal index for a single journal install.

Hi @ctgraham :slight_smile:

As per your suggestion, I put a DirectoryIndex line in my htaccess config

DirectoryIndex index.php

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

Going to aghamx.com would then redirect to http://www.aghamx.com/journal but returns a 404 error. Going to http://www.aghamx.com/index.php/journal would load the homepage but displays incorrectly. Also, I could still not find the Site Settings in the admin dashboard.

These lines won’t work for you:

RewriteCond %{REQUEST_URI} !^./index.php/.$
RewriteRule ^/aghamx/(.*)$ /aghamx/index.php/$1 [QSA,L]

They say: the next RewriteRule applies only to requests which don’t start with any character, followed immediately by the literal “/index.php/”, and ending exactly in one character. Then, for any request that matches that and starts exactly with “/aghamx/” followed by any captured characters, redirect the request to index.php under the aghamx folder, with the captured characters apended.

The two regular expressions are contradictory.

Try directives of:

  RewriteCond %{REQUEST_URI} !^.*/index.php/.*$
  RewriteRule ^/(.*)$ /index.php/$1 [QSA,L]

Hi @ctgraham

Sorry I’ve been busy the past days. I implemented those lines but I don’t observe any effect in the URL.

What specifically do you mean by “don’t observer any effect in the URL”?

Do you still have restful_urls on in your config.inc.php?

I have the same issue, I can not see the SITE SETTING in

Admin → Administration → Site Settings → Journal redirect

In my case there is no other users, and the only user is the one who installed the OJS 3.0.2.0.

When I try to access , It get

…/index.php/index/user/authorizationDenied?message=user.authorization.accessDenied

I don’t find it either as the journal admin

@kawahyu, do you have a site with multiple journals, or with a single journal? This option will only appear if your site has multiple journals.

@Dilan_Rostam, I wonder if this thread might be relevant to your error message:

1 Like

Sorry, I think it will appear for all. I manage single journal.

Thanks

I wish that one single easy option could MASK the long OJS URL to a short custom version. Such as

http://mydomain.com/index.php/MyJournal

http://mydomain.com/MyJournal

and if one journal to

http://mydomain.com/

Is there any new release of OJS on the way please? I thought the issue with Static page menu item will be addressed in new release, am I right?

I have the same situation. My single journal is on the subdomain http://journal.domain.com Now setup in config.inc.php:

base_url[index] = http://journal.domain.com
base_url[journal] = http://journal.domain.com/journal
restful_urls = On

and .htaccess file:

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

Now the site opens with http://journal.domain.com/journal. How to remove the trailing /journal? That is, that the site opened by URL http://journal.domain.com

Dear @ctgraham
I would like to continue on this as I was upgrading from 3.1.2.4 → 3.2.1.2 an encountered the issue of redirecting API calls . I just want this single journal on the site with pretty URLs without having to fiddle with .htaccess except for enabling RESTful URLs.
So I inspected the code for the $site->getRedirect() and related.

First: I could not quite find out what the setting in the db actually does.
Second: As I understood the redirect setting should be in https://github.com/pkp/pkp-lib/blob/master/templates/admin/contextSettings.tpl , but there is not even code for it. Is it really missing?

Maybe @NateWr and @asmecher could clarify what redirect :: true/false actually does and how to get there.

Thanks for your help and all the best
Klaus

Hi, @klausru.

Can you describe the problem you are seeing with redirecting API calls in 3.2.1-2? The issue #4919 is believed resolved as of 3.2.x.

In older versions of OJS, you could set a redirect at the site level to a specific context (journal). In 3.2, I think this is automatic in the case of a single journal installation.

Can you clarify what code you are looking at with respect to redirect :: true/false?

Dear @ctgraham

the issue is as here: SOLVED: Upgrade from OJS 3.1.2.4 to OJS 3.2.1.2: problems with url api in back-office
or here: [OJS 3.2.0.3] Error on Submission Page - #22 by drugurkocak

base_url = "https://www.medienpaed.com"
base_url[medienpaed] = https://www.medienpaed.com
restful_urls = On

I pretty much tried all of those .htaccess rewrite rules but none really work. They either 404 or 500 for the whole site or they don’t properly affect the API calls. My current .htaccess is (from: [Solved] Problems with api submissions error on submissions page - #10 by ctgraham):

# If the URI already has index.php in it, don't change it
RewriteCond %{REQUEST_URI} !/index.php/
RewriteCond %{REQUEST_URI} !/medienpaed/
# Skip existing directories if Apache 2.2 or later
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
# Skip existing files if Apache 2.2 or later
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
# Rewrite all other requests to a specific journal in OJS
RewriteRule ^(.*)$ index.php/medienpaed/$1 [QSA,L]

# If the URI already has index.php in it, don't change it
RewriteCond %{REQUEST_URI} !/index.php/
RewriteCond %{REQUEST_URI} /medienpaed/
# Skip existing directories if Apache 2.2 or later
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
# Skip existing files if Apache 2.2 or later
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
# Rewrite all other requests to a specific journal in OJS
RewriteRule ^medienpaed(.*)$ index.php/medienpaed/$1 [QSA,L]

Too bad that this code only removes the error message and puts the API request in some loop, without any effect (bonkers?). Thus I can’t use filters on submissions etc.
As earlier posts mentioned that redirect in site table should make redirecting single journal instances very easy, I started to try to figure out what this actually does. Its value used to be set to "1". A fresh install sets or leaves the value on “0”. But changing the value has no effect.

Any idea?

Solved with this solution: [OJS 3.2.0.3] Error on Submission Page - #24 by KBodarwe

I don’t know why it did not work before, but for now it’s fine.

A post was split to a new topic: Issues with config.inc.php