SOLVED: Upgrade from OJS 3.1.2.4 to OJS 3.2.1.2: problems with url api in back-office

Hi all,

After some hard :slight_smile: tests, I want to share htaccess configuration that I could successfully removed index.php and journal path on a multijournal & multidomain OJS installation.

I am aware that this solution my be limited to my server configuration, so I will try to share all details related to OJS environment.

I need to say that I couldn’t get success with this model on a single journal setup.
Besides the site domain, at least a different domain is needed for the journal.

In this test scenario, cancer-research.net is the main domain & ojs 3 is installed on it.
Other domains are alias of cancer-research.net with their own mail acccounts.

In this scenario, I can delete existing or generate a new journal, modify all journal settings on their own settings panel and perform all editorial processes. The mail system also runs well.

The only error I get is “Access to XMLHttpRequest at … has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

This error at the settings wizard at site administration section is a well known error due to CORS policy and it is the topic of another discussion.

If anyone wants to examine and make some tests, those are the usernames:

author user : author password: 123456
reviewer user : reviewer password: 123456
editor user : editor password: 123456
Journal manager : manager password: 123456

Test Journal of Cancer Research (https://www.cancer-research.net/tjcr) and Test Journal of Social Sciences (https://www.cancer-research.net/tjss) don’t have their own domains, but all others have their own domains (please look at config).

 base_url = "https://www.cancer-research.net"
 base_url[index] = https://www.cancer-research.net/index
 base_url[tjcr] = https://www.cancer-research.net/tjcr
 base_url[tjss] = https://www.cancer-research.net/tjss
 base_url[jfm] = https://www.adlitip.net
 base_url[jfs] = https://www.adlibilimler.online
 base_url[cmj] = https://citymedicaljournal.xyz
 base_url[jcr] = https://www.cancer-research.xyz

The Server Configuration:

Operating system : CentOS Linux 7.9.2009
Webmin version : 1.962
Virtualmin version : 6.14
Kernel and CPU : Linux 3.10.0-1160.11.1.el7.x86_64 on x86_64

Apache version : 2.4.6
PHP versions : 7.2.24, 7.3.20, 7.4.14
MySQL (MariaDB) version : 10.4.17

Modules for PHP 7.4: bcmath bz2 calendar cgi-fcgi Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv imap intl json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar posix pspell readline Reflection session shmop SimpleXML soap sockets sodium SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib

Pear modules for PHP 7: Archive_Tar Console_Getopt PEAR PEAR_Manpages Structures_Graph XML_Util

PHP script execution mode : CGI wrapper (run as virtual server owner)

htaccess directives for virtual host:

 Options +ExecCGI +FollowSymLinks +IncludesNOEXEC -Indexes +SymLinksIfOwnerMatch
  allow from all
 AllowOverride All
 Require all granted

htaccess directives for userdir:

<Directory "/home/*/public_html">
     Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
     allow from all
    AllowOverride all
    Require all granted
</Directory>

#htaccess directives to remove journal path and index.php on OJS 3.2.1.2 

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /


# Rules for  Test Journal of Forensic Medicine 

RewriteCond %{SERVER_NAME} ^(www\.)?adlitip.net
RewriteRule ^api/v1(.*)$ index.php/jfm/api/v1$1 [L,R=307]
RewriteCond %{SERVER_NAME} ^(www\.)?adlitip.net
RewriteCond %{REQUEST_URI} !/jfm/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/jfm/$1 [L]


# Rules for  Test Journal of Cancer Sciences 

RewriteCond %{SERVER_NAME} ^(www\.)?cancer-research.xyz
RewriteRule ^api/v1(.*)$ index.php/jcr/api/v1$1 [L,R=307]
RewriteCond %{SERVER_NAME} ^(www\.)?cancer-research.xyz
RewriteCond %{REQUEST_URI} !/jcr/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/jcr/$1 [L]


	
# Rules for  Test City Medical Journal

RewriteCond %{SERVER_NAME} ^(www\.)?citymedicaljournal.xyz
RewriteRule ^api/v1(.*)$ index.php/cmj/api/v1$1 [L,R=307]
RewriteCond %{SERVER_NAME} ^(www\.)?citymedicaljournal.xyz
RewriteCond %{REQUEST_URI} !/cmj/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/cmj/$1 [L]



# Rules for Test Journal of Forensic Sciences
RewriteCond %{SERVER_NAME} ^(www\.)?adlibilimler.online
RewriteRule ^api/v1(.*)$ index.php/jfs/api/v1$1 [L,R=307]
RewriteCond %{SERVER_NAME} ^(www\.)?adlibilimler.online
RewriteCond %{REQUEST_URI} !/jfs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/jfs/$1 [L]


# Rules for Test Journal that doesnt have own domains
RewriteRule ^api/v1(.*)$ index.php/\b(tjcr|tjss)\b/api/v1$1 [L,R=307]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(tjcr|tjss|another_journal)(.*)$ /index.php/$1$2 [L]
RewriteRule ^api/v1(.*)$ index.php/index/api/v1$1 [L,R=307]

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


</IfModule>

; OJS 3 config.inc.php configuration

; The canonical URL to the OJS installation (excluding the trailing slash)
 base_url = "https://www.cancer-research.net"

allow_url_fopen = Off

 base_url[index] = https://www.cancer-research.net/index
 base_url[tjcr] = https://www.cancer-research.net/tjcr
 base_url[tjss] = https://www.cancer-research.net/tjss
 base_url[jfm] = https://www.adlitip.net
 base_url[jfs] = https://www.adlibilimler.online
 base_url[cmj] = https://citymedicaljournal.xyz
 base_url[jcr] = https://www.cancer-research.xyz


restful_urls = On
1 Like