Problem to enter web with or without "www" in OJS 3.3.0-11

Problem entering the web with or without “www” in OJS 3.3.0-11

The URL of my OJS installation only allows viewing of the journal content when “www” is not included in the URL (works perfect)

But when I add “www” it gives an error message: 400 Bad Request

The digital certificate (SSL) is correct and includes the domain with and without “www”.

In other journal urls with previous OJS versions that we have (3.3.0-8, 3.3.0-7) everything is perfect (it allows using URLs with and without “www” but with version 3.3.0-11 the problem appears.

As a workaround edit the OJS system configuration file ( by adding “www” in allowed_hosts:

; allowed_hosts = ‘[“myjournal.tld”, “anotherjournal.tld”, “mylibrary.tld”]’
allowed_hosts = “[""]”

But now it allows me to enter the magazine only with
When trying to enter with the error appears: 400 Bad Request

Is there a way for OJS 3.3.0-11 that will allow me to access the OJS website with or without “www”?

What is the cause of this error?

I appreciate any help


I fixed the problem by adding “” in allowed_host in line 96 of the file

; allowed_hosts = ‘[“myjournal.tld”, “anotherjournal.tld”, “mylibrary.tld”]’
allowed_hosts = “["", ""]”

Is this correct way to solve the problem to access the OJS site with and without “www”?

Yes, this is correct. You need to list all domains. But to enclose the array you should use single quotes.

1 Like

It’s okay. thank you very much for your help!

I followed your advice “use single quotes”:

allowed_hosts = ‘[“”, “”]’

Thanks @mpbraendle !