This means that jota.website is really only working as an alias of journals.docuracy.co.uk, and calls to https://jota.website are rewritten as https://jota.website/jota; other pages all have an unwanted “/jota/” in their urls. The root administration pages are available on both urls. I want to restrict the administration to journals.docuracy.co.uk only, and remove the unwanted “/jota” from the urls for that journal.
Having tried various settings for base_url[jota] and base_url[index], none of which had the desired effect (either no effect, “too many redirects”, or server 500 errors), I don’t think these settings are relevant.
The documentation suggests that the Docker image has some inbuilt URL rewriting, and that I might need to modify its behaviour with custom .htaccess directives. Can anyone suggest a solution, please?
Hello @Stephen_Gadd, I hope I can help you, since I am using an OJS Dockerized environment with NGINX reverse proxy.
However, I didn’t understand exactly what is your problem.
I am assuming that you have this Plesk/NGINX barebones trying to redirect to OJS inside Docker, and your running container have a map 8491:443. Check if you can access it directly, a curl from the host machine to https://127.0.0.1:8491. If so, it should work…
Your configuration of reverse proxy seems good for me, and I did not need to configure my .htaccess with this kind of configuration.
Is the https://127.0.0.1:8491 the right address to put there? I cannot access the address https://journals.docuracy.co.uk:8491 (is it blocked to outside?)
Keep in mind that the ojs.config.inc.php should have the 127.0.0.1 in the allowed_hosts, or you may prefer to redirect using domain.
Thanks for your reply, Henrique. I didn’t explain very clearly that the Nginx settings do allow the journal to be viewed: I simply want to hide part of the path which is displayed in the browser navigation bar, so for example instead of “https://jota.website/jota/contact” we would see only “https://jota.website/contact”.
Oh now I see, thanks God I said it should work haha
I didn’t configure it here (to remove the name of the journal), but I believe you can achieve it by puting in the .htaccess , similar to the index.php removal:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/jota/(.*)$
RewriteRule ^jota/(.*)$ /$1 [L,R=301]
However, I’ve tried your suggestion and many variations in the apache.htaccess file, but all result in 404 Not Found errors.
My latest effort is based on the realisation that (for example) if anyone types “https://jota.website/contact” in their browser, content needs to be served from “/jota/contact”:
RewriteEngine On
# Check if the host is jota.website
RewriteCond %{HTTP_HOST} ^(www\.)?jota\.website$ [NC]
# Redirect all requests starting with / to /jota/
RewriteCond %{REQUEST_URI} !^/jota/
RewriteRule ^(.*)$ /jota/$1 [L,R=301]
… this rewrites the URL to “https://jota.website/jota/contact” in the browser bar (defeating the point of trying to hide the “jota/” part of the URL), and results in a 404 Not Found error.
I have a growing sense that editing the apache.htaccess file is not going to provide a solution, but that there needs to be some modification of the php code or perhaps the configuration file, but would be happy to be proved wrong!
In Spain we use a saying that goes, “Mal de muchos, consuelo de tontos.” (pain of many, consolation of fools?). It says little about me but the truth is that I feel a little comforted to see that I am not the only one who has struggled with this.
In confidence, writing rules for mod_rewrite are by far the most time consuming (and annoying) thing I’ve done in all the years I’ve been using OJS.
I try to summarize my findings on this topic:
OJS can be run as webApp, but also from command line, or as API calls and the behavior of OJS can vary because the contexts are different (reverse proxy) and also because different libraries and strategies have been used to discover the url or protocol.
OJS is designed to work as “multi-tenant”, so when we run it as “single-tenant” (one ojs for each journal) we have to play with the urls (I’ve been doing it for more than 10 years: it’s not impossible, but very uncomfortable).
OJS prefers not to use clean_URLs.
In any of the 3 scenarios you will have to struggle, but if (as in my case) you want to use OJS behind a reverse proxy, with single-tenant and with resftulURLs, I can tell you that it will make you sweat… but hey, we are engineers, right?
The solution we have found (while waiting for someone to come up with something better), consists of a combination of configuration variables (config.inc.php, apache…) and rewrite rules.