Here is a little PHP code snippet to add to your 404 page, in order to get an email alert with all sorts of useful data, each time a 404 page is accessed.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if(isset($_SERVER[’HTTP_REFERER’])) {
$ref=$_SERVER[’HTTP_REFERER’];
}
else{
$ref=’none’;
}
$sitename=’Reflection Media’;
$recipient = ‘mail@gmail.com’;
$subject = ‘New ‘.$sitename.’ 404 accessed’;
$mail_body = ‘
A new 404 page has been accessed:
The accessed [...]