Hi,
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:
./checkUrls.sh listNoRestMulti
1 --> VALID - Temporal redirection
302: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php
2 --> VALID - Temporal redirection
302: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/index
3 --> VALID - Active
200: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/testdrive-journal/about
4 --> VALID - Active
200: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/testdrive-journal/$$$call$$$/page/page/css?name=stylesheet
5 --> VALID - Unauthorized
403: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/testdrive-journal/api/v1/contexts/1
6 --> VALID - Active
200: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/testdrive-journal/oai
7 --> VALID - Temporal redirection
302: https://demo.publicknowledgeproject.org/ojs3/testdrive/index.php/index/install/install
SUMMARY OF YOUR URLs HEALTH:
- 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.
Cheers,
m.
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.