Dear PKP users and developers
We have moved a custom domain (journal-name.domain.com) to a multi-journal OJS (with base-domain: base-site.com). We have followed the instructions in:
However these instructions did not say anything about how to set up apache for port 443. The thing that solved our problem was to define the DirectoryIndex in Apache’s 443 conf-file.
We used the following Apache-conf-file for port 443 and journal-name.domain.com:
<VirtualHost *:443>
ServerName journal-name.domain.com
DocumentRoot "/var/www/html/"
<Directory /var/www/html>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Require all granted
DirectoryIndex index.php/journal-name**
</Directory>
...
#logging and SSL settings
...
</VirtualHost>
We are using the following for port 80 and journal-name.domain.com
<VirtualHost *:80>
ServerName journal-name.domain.com
DocumentRoot "/var/www/html/"
<Directory "/var/www/html/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
...
#logging settings
...
</VirtualHost>
This is the apache-conf file for port 443 and main-site.com:
<VirtualHost *:443>
ServerName main-site.com
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
AllowOverride ALL
Require all granted
DirectoryIndex index.php
</Directory>
## Logging
ErrorLog "logfile_error_ssl.log"
ServerSignature Off
CustomLog "logfile.log" combined
## Header rules
Header Set Strict-Transport-Security "max-age=31536000"
## SSL directives
...
</VirtualHost>
This is the apache-conf file for port 80 and main-site.com:
<VirtualHost *:80>
ServerName main-site.com
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
## Logging
ErrorLog "logfile_error.log"
ServerSignature Off
CustomLog "logfile.log" combined
</VirtualHost>
Finally, this is our .htaccess file to set up restful_urls :
RewriteEngine on
RewriteCond %{HTTP_HOST} main\.server\.name\.com$ [NC]
RewriteRule ^(.*)$ https://main-site.com/$1 [L,R=301]
RewriteEngine On
RewriteBase /
## Has its own domain
RewriteCond %{SERVER_NAME} ^(www\.)?journal-name.domain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/journal-name/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
## Mainsite of OJS with journal overview
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^index/(.*)$ /index.php/index/$1 [QSA,L]
RewriteEngine on
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteEngine On
RewriteRule ^/not_found_redirect/ http://journal-name.domain.com%{REDIRECT_REQUEST_URI} [R,L]
-
Does this setup look “correct”?
-
We have a problem: We can not set up a custom error page for 404 errors. We have tried to add ErrorDocument 404 /404-file.html to the apache conf-files and to .htaccess files. The only thing that seems to work is to use: AllowOverride None. However, when using that command the rest of the site is broken!
-
Another issue with this setup is that I need to log in twice in the backend when swithing from a jounral in domain1 to a journal in domain2. Is it possible to solve that?
We are using CentOS with Apache/2.4.6
PHP 7.1.17
OJS 3.1.1.4