Cannot create new journal

I recently updated the OJS version from 3.3.0.11 to 3.3.0.13. I have two journals in my installation: one “real” and another for tests. I need to create a new one, but I got a general error anche in the Cache from firefox:

https://mysubdomain.com/_/api/v1/contexts [HTTP/1.1 404 Not Found 144ms]

I have the main configuration of OJS in https://mysubdomain.com/, the test journal in https://mysubdomain.com/test and the real journal in https://realjournal.com/

I have this configuration in .htaccess:


<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	## Journal has its own domain
	RewriteRule ^api/v1(.*)$ index.php/realjournal/api/v1$1 [L,R=307]
	
	RewriteCond %{SERVER_NAME} ^(www\.)?realjournal.com
	RewriteCond %{REQUEST_URI} !/realjournal
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ /index.php/realjournal/$1 [QSA,L]
	
	
	#Mainsite of OJS with journal overview
	RewriteRule ^api/v1(.*)$ index.php/test/apiv1$1 [L,R=307]
	RewriteCond %{SERVER_NAME} ^(www\.)?mysubdomain.com
	RewriteCond %{REQUEST_URI} !/test/
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^index/(.*)$ /index.php/index/$1 [QSA,L]
</IfModule>

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>

In the config.inc.php I have

allow_url_fopen = Off

base_url[index] = https://mysubdomain.com/index

base_url[real_journal] = https://realjournal.com
base_url[test] = https://mysubdomain.com/index.php/test

restful_urls = On

I also tried to add the base_url[second_journal] in the config, before creating it, but I still got the api error.
How come I cannot create a new journal now?

Hi @Lara_M

The RewriteRule lines seems to be incorrect. You are declaring:
RewriteRule ^api/v1(.*)$ index.php/realjournal/api/v1$1 [L,R=307]

This rule will not match since your URL is https://mysubdomain.com/_/api/v1/contexts. You should adjust the rule to something like:
RewriteRule ^_/api/v1(.*)$ index.php/realjournal/api/v1$1 [L,R=307]

Notice that you need to adjust accordingly to your complete URL, I am only adapting to the info you have pasted on the thread. Maybe you need to add the `/index.php/journalName’ in the rule as well. However, it is something that you will have to test.

Best,
Israel

Best,
Israel

1 Like

Thank you for your answer, it seems to be a bigger problem… I need to try different things. Isn’t anyone who is experiencing this?

So, at the end I followed this: API calls fail if context path is obscured by RESTful URL configuration · Issue #4919 · pkp/pkp-lib · GitHub and with that line in .htaccess

RewriteRule ^_/api/v1/(.*) index.php/_/api/v1/$1 [L,R=307]

It works again!