Apologies if I sounded too depressive.
It’s a mixture of work overtaking you and not wanting to get in the way if there are people with more energy.
I don’t know if it will help you (maybe others who use docker can share their experience), but in the past I’ve had problems writing redirect rules that work correctly behind a proxy (the standard rules didn’t work for me) and with the way OJS builds URLs…
My solution, after a lot of trial and error, consists of a combination of rules and overwriting the index.php so that OJS assumes the base_url that I indicate (instead of trying to find it out).
Here’s an example of how I have a journal on a subpath, specifically for: https://revistes.uab.cat/brumal
For index.php (that looks like is working fine in your side):
$journalPath='brumal';
$_SERVER['SCRIPT_NAME'] = '/'. $journalPath . $_SERVER['SCRIPT_NAME'];
$_SERVER['PHP_SELF'] = '/'. $journalPath . $_SERVER['PHP_SELF'];
// Initialize global environment
define('INDEX_FILE_LOCATION', __FILE__);
$application = require('./lib/pkp/includes/bootstrap.inc.php');
// Serve the request
$application->execute();
Most relevant variables in config.inc.php (ojs 3.2) are:
base_url[index] = https://revistes.uab.cat/brumal/index
base_url[brumal] = https://revistes.uab.cat/brumal
trust_x_forwarded_for = On
force_ssl = Off
restful_urls = On
And Apache virtual host is:
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule expires_module modules/mod_expires.so
<VirtualHost *:80>
ServerName revistes.uab.cat
ServerAlias revistes.uab.es
DocumentRoot /var/www/html
DirectoryIndex index.php index.html
RewriteEngine On
AcceptPathInfo On
SetEnv HTTPS On
<Directory /var/www/html>
# Redirect root to index
RewriteRule ^/?$ index.php/brumal/index [L=307]
RewriteRule ^brumal$ index.php/brumal/index [L=307]
# Bloc admin pages with DB info:
## RewriteRule ^/?brumal/index/admin/systemInfo/?$ /brumal/index [L]
## Force httpS (basically to reach the API):
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} ^/brumal\/api\/v1\/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*) https://%{SERVER_NAME}/brumal/index.php/$1 [L,R=307]
# OJS expects to be at root, so removing journal's subdomain:
RewriteCond %{REQUEST_URI} ^/brumal
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^brumal/(.*)$ $1 [QSA,L]
## Rewrite API calls if not including subdomain journals:
RewriteCond %{REQUEST_URI} api\/v1\/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ brumal/index.php/brumal/$1 [L,R=307]
# Renames the short journal's rule:
RewriteCond %{REQUEST_URI} !^index.php\/brumal
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/brumal/$1 [QSA,L]
# This removes index.php from the url (apache 2.2 and new ones)
RewriteCond %{REQUEST_URI} !^/brumal/index.php
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</Directory>
# LogLevel alert rewrite:trace2
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
Take in consideration:
- This is for OJS 3.2
- Rules could (should) be simplified/improved.
- Most important: A very few admin urls are not properly redirected “that it’s a bug, but I don’t want editors to raise them and I can reach them so I see this as a feature”).
TL;DR; IMO, this is a mod_rewrite issue… that by the way, it’s one of the most complex problems I always find in OJS… and I would love to find some basic configs to include in the docker images “out-of-the-box” (ie: domain, subdomain, subdomain+path deeply tested examples).
You will probably like to join this gitHub Discussion:
@AndrewGearhart dealed with this recently so he will probably could help you more than me with this.
Take care and keep in touch,
m.