Send an email on every 404 - App Files

Hi,

Is there any way to trigger some code (to send an e-mail example) when a 404 (exception NotFoundException).

In case of broken links, folder no longer shared, etc…

Thanks you a lot

An 404 and other http errors are usually generated by the web server and NOT Nextcloud. Therefore you need to set-up a solution outside of Nextcloud. A possible solution would be to create a monitor script which checks the content of the web server log file and sends an email if such an error appears.

No because when a 404 is trigerred, nextcloud redirect to the home and trigger a NotFoundException, here ViewController.php

	public function index($dir = '', $view = '', $fileid = null, $fileNotFound = false) {
		if ($fileid !== null) {
			try {
				return $this->redirectToFile($fileid);
			} catch (NotFoundException $e) {
				return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', ['fileNotFound' => true]));
			}
		}

So there is no 404 in the HTTP meaning

No one please ?