Jump to content

Logging links resulting in a 404-error.


formmailer
 Share

Recommended Posts

Hi!

I would like to get an notification/overview of links that result in a 404 error on my site. This includes links on external sites and internal links.

Would it be possible to save the $HTTP_REFERERs resulting in a 404, somewhere in the database?

/Jasper

Link to comment
Share on other sites

I think that your best bet for this is your apache log:

grep ' 404 ' /path/to/access_log

Though that's assuming you are logging referrers in your access log. I also like Google Webmaster tools for finding 404s.

You could always create a http404.php template file for ProcessWire, and then have it log the info somewhere:

$log = new FileLog($config->paths->logs . '404.txt'); 
$log->save($sanitizer->text($_SERVER['HTTP_REFERER']) . ' => ' . $sanitizer->text($_SERVER['REQUEST_URI'])); 

But the above may be overkill since info about 404s is already be tracked in apache logs and web analytics.

Link to comment
Share on other sites

Thank you Ryan. I was looking for a way to make the 404's easily available for editors, so that they could react on these.

But I guess you are right, probably it would be overkill to do this. They can get the data from the webstats and the webmaster tools.

/Jasper

/Jasper

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...