Check if your OJS urls are healthy


One of the things that took more time in my sysadmin work is checking my mod_rewrite rules.
Rules change depeding on your url needs and on your ojs configuration/version so I always need to do a lot of trial-error… that could be exhausting.

So I did this dirty bash script to check if your OJS urls are fine:

You only need to decide your list of urls and the script will check if you get valid pages or 404 errors.

I added a first list for the most simple scenario (no restful, multi-tenant), but the idea is extending it to other common cases (restful, hide journalcontext, single-tenant…).

An example of the output when running to check pkp’s demo site:

 ./ listNoRestMulti
1 --> VALID - Temporal redirection
2 --> VALID - Temporal redirection
3 --> VALID - Active
4 --> VALID - Active
5 --> VALID - Unauthorized 
6 --> VALID - Active
7 --> VALID - Temporal redirection

- Active: 7 - Those urls are valid.
  - Redirect: 3 - Redirected url are usually valid, but url destination need to be add to the list and checked too.
- Errors found: 0 - Errors NEED that be fixed, like notFound and other unkown codes.
  - Unkown: 0 - URLs that returned an unexpected code and need a detailed review. Considered errors.

RESULT: Looks like your site looks healthy

Expert help to check and extend the sets of urls would be really appreciated.


PD: Please, take in consideration this is a very dirty solution. If is useful to anybody it could be extened and improved to be more elegant, even include as a “health check” in ojs upgrade scripts.


Well… I’ve “gone ahead” and added some colour and comments to the script and I’ve put it in a repo in case the thing grows… but the substantial part (which is the entrypoints list) is still unmature, so comments and PRs are really welcome.

Changes changes form former gist script are:

  • Is a general url tester not limited to ojs, so renamed to pkpCheckUrls.
  • A “basic” list that I think every OJS like to honor was created.
  • Still very alpha but also included a couple of lists with urls with combinations of:
    • domain/folder
    • explicit/RESTful
    • multi/single-tenant
    • with/without JournalSlug
  • Improved presentation with colors and texts explaining better what each url is useful for or what is wrong.
  • Counting all types of results to show a better summary.
  • Variable name simplified to refer OJS terminology (base_url, journalContext).

Now output looks as follows:

Probably next step would be move the entrypoints lists out of the script, and/or set base_url and the journalContext as script’s arguments, but it’s good enough for me so I will only add those changes if somebody asks for them or contribute with a PR.

Some ideas to extend the script:

  • Making documentation for each list of endopoints explaining how to set and apache virtualhost/htaccess… so the script could refer them to help people finding their ruleset.
  • Extend or refer a OxS mod_rewrite ruleset generator.

Repo avaliable here: