Pour savoir quelles sont les erreurs rencontrées par mon site, et car je reçois beaucoup de rapports d'erreurs de Google Analytics, j'ai trouvé sur le net un petit code à rajouter dans mes fichiers d'erreurs 40x.
Je précise que je suis un bon newbie.
Pour cela, j'ai édité le .htaccess de ma racine de cette manière :
Code : Tout sélectionner
(...)
# --- Other options ---
# Erreur 400, Mauvaise requête
ErrorDocument 400 /errors/404.php
# Erreur 401, Non autorisé
ErrorDocument 401 /errors/401.php
# Erreur 403 , Interdit
ErrorDocument 403 /errors/401.php
# Erreur 404, Non trouvé
ErrorDocument 404 /errors/404.php
# Erreur 500, Erreur interne du serveur
ErrorDocument 500 /errors/404.php
(...)Code : Tout sélectionner
(...)
<?php
if ( !$_SERVER['HTTP_REFERER']) {
$_SERVER['HTTP_REFERER'] = 'URL Directe.'; }
if ( !$_SERVER["REDIRECT_REMOTE_USER"]) {
$_SERVER["REDIRECT_REMOTE_USER"] = 'Aucun !'; }
$titre = "Erreur 401 sur le site";
$msg = "Infos techniques :\r\n\n";
$msg .= "- Serveur : " . $_SERVER['HTTP_HOST'] . "\r\n";
$msg .= "- Provenance : " . $_SERVER['HTTP_REFERER'] . "\r\n";
$msg .= "- Demande : " . $_SERVER['REQUEST_URI'] . "\r\n";
$msg .= "- IP : " . $_SERVER['REMOTE_ADDR'] . "\r\n";
$msg .= "- Identifiant : " . $_SERVER["REDIRECT_REMOTE_USER"] . "\r\n";
$msg .= "- Configuration : " . $_SERVER['HTTP_USER_AGENT'] . "\r\n\n";
$msg .= "-----\r\n\n";
?>
<div id="error">
<div align="center">
<IMG alt="/!\" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/warning.gif" /> Attention ! <IMG alt="/!\" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/warning.gif" />
<br />
Vous n'avez pas (ou plus) accès à cette page !<br />
<br />
</div>
<table align="center" cellspacing="2" cellpadding="2" width="450" border="0">
<tr>
<td width="125"><u>Serveur d'origine :</u></td>
<td align="left"><?php echo $_SERVER['HTTP_HOST']; ?></td>
</tr>
<tr>
<td width="125"><u>Provenance :</u></td>
<td align="left"><?php echo $_SERVER['HTTP_REFERER']; ?></td>
</tr>
<tr>
<td width="125"><u>Page demandée :</u></td>
<td align="left"><?php echo $_SERVER['REQUEST_URI']; ?></td>
</tr>
<tr>
<td width="125"><u>Votre adresse IP :</u></td>
<td align="left"><?php echo $_SERVER['REMOTE_ADDR']; ?></td>
</tr>
<tr>
<td width="125"><u>Identifiant soumis :</u></td>
<td align="left"><?php echo $_SERVER["REDIRECT_REMOTE_USER"]; ?></td>
</tr>
<tr>
<td width="125"><u>Votre configuration :</u></td>
<td align="justify"><?php echo $_SERVER['HTTP_USER_AGENT']; ?></td>
</tr>
</table>
<br />
<img src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/puce.gif" width="11" height="11" border="0" align="middle" />Il se peut que votre autorisation d'accès ait été supprimée par notre équipe (droit, maintenance, mise à jour, ...), et dans ce cas, veuillez vous rapprocher du <a href="mailto:wda@wda-fr.org?subject=Message d'erreur 401.&body=Bonjour,%0d%0a%0aMon identifiant "<?php echo $_SERVER["REDIRECT_REMOTE_USER"]; ?>" n'est plus reconnu.">bureau de l'association</a> pour de plus amples détails.<br />
<img src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/puce.gif" width="11" height="11" border="0" align="middle" />Il se peut aussi que vous n'en ayez jamais obtenue.<br />
<?php mail("[email protected]",$titre,$msg);// envoi du message ?>
<div align="center"><br />Dans les deux cas, un mail automatique vient d'être envoyé au Webmaster de l'association avec les informations récoltées ci-dessus, en noir).<br /><br />- <a href="Javascript:history.go(-1)">Retour à la page précédente</a> -</div>
</div>
(...)Code : Tout sélectionner
(...)
<?php
if ( !$_SERVER['HTTP_REFERER']) {
$_SERVER['HTTP_REFERER'] = 'URL Directe.'; }
$titre = "Erreur 404 sur le site";
$msg = "Infos techniques :\r\n\n";
$msg .= "- Serveur : " . $_SERVER['HTTP_HOST'] . "\r\n";
$msg .= "- Provenance : " . $_SERVER['HTTP_REFERER'] . "\r\n";
$msg .= "- Demande : " . $_SERVER['REQUEST_URI'] . "\r\n";
$msg .= "- IP : " . $_SERVER['REMOTE_ADDR'] . "\r\n";
$msg .= "- Configuration : " . $_SERVER['HTTP_USER_AGENT'] . "\r\n\n";
$msg .= "-----\r\n\n";
?>
<div id="error">
<div align="center">
<IMG alt="/!\" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/warning.gif" /> Attention ! <IMG alt="/!\" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/warning.gif" />
<br />
La page que vous venez de demander n'existe pas (ou plus) !<br />
<br />
</div>
<table align="center" cellspacing="2" cellpadding="2" width="450" border="0">
<tr>
<td width="125"><u>Serveur d'origine :</u></td>
<td align="left"><?php echo $_SERVER['HTTP_HOST']; ?></td>
</tr>
<tr>
<td width="125"><u>Provenance :</u></td>
<td align="left"><?php echo $_SERVER['HTTP_REFERER']; ?></td>
</tr>
<tr>
<td width="125"><u>Page demandée :</u></td>
<td align="left"><?php echo $_SERVER['REQUEST_URI']; ?></td>
</tr>
<tr>
<td width="125"><u>Votre adresse IP :</u></td>
<td align="left"><?php echo $_SERVER['REMOTE_ADDR']; ?></td>
</tr>
<tr>
<td width="125"><u>Votre configuration :</u></td>
<td align="justify"><?php echo $_SERVER['HTTP_USER_AGENT']; ?></td>
</tr>
</table>
<br />
<img src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/puce.gif" width="11" height="11" border="0" align="middle" />Il se peut que cette page ait été retirée par notre équipe (maintenance, mise à jour, ...), et dans ce cas, veuillez accepter nos excuses pour la gène occasionnée et n'hésitez pas à retenter l'opération dans quelques heures.<br />
<img src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/pict/puce.gif" width="11" height="11" border="0" align="middle" />Il se peut aussi que celle-ci n'ait jamais existée.<br />
<?php mail("[email protected]",$titre,$msg);// envoi du message ?>
<div align="center"><br />Dans les deux cas, un mail automatique vient d'être envoyé au Webmaster de l'association avec les informations récoltées ci-dessus, en noir).<br /><br />- <a href="Javascript:history.go(-1)">Retour à la page précédente</a> -</div>
</div>
(...)Et pour les 404 :Infos techniques :
- Serveur : monurl
- Provenance : URL Directe.
- Demande : /wiki-2014/includes/FileDeleteForm.php
- IP : 66.249.64.73
- Identifiant : Aucun !
- Configuration : Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
-----
La plupart du temps, les URLs demandées n'existent même pas dans mon arborescence, et n'ont jamais existé.Infos techniques :
- Serveur : monurl
- Provenance : URL Directe.
- Demande : /index.php?page=debarrasrobots.txt
- IP : 157.55.32.99
- Configuration : Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
-----
Ou traine ces infos ?
Comment parer ce genre de routine ?
Merci de votre aide...