Jump to content

[Solved] Weird 404 behaviour when including/bootstrapping PW from another script


ian
 Share

Recommended Posts

I've come across some strange behaviour that I can't figure out, while bootstrapping PW from another script.  I have a few php scripts that I bootstrap PW in the recommended way, by including ./index.php.  This works fine and I can access the API as normal.  I use these to retrieve information for old or external links that still reference pages on my pre-Processwire days.  

The scripts work fine - I can retrieve the necessary record, the information is displayed correctly in the browser and returns a 200 status code (or is correctly redirected - some have 301 redirects to the appropriate new url).  

However this seems to somehow trigger some aspect of the 404 handling routine.  I say some aspect because Chrome dev tools doesn't show a 404, and the actual 404 page isn't displayed, but if I monitor sessions (I have Session Database Handler installed)  each call to one of these scripts displays /http404/ as the URL in the active sessions in the admin.

(Now, as I write this I wonder if that's the intended behaviour, given that this is not a true page in the page tree). 

But - if I want to monitor actual 404s (e.g. via the logging method described here) so I can look for missing pages, out of date links etc.,  the log is filled up with spurious "false 404s" from calls to my bootstrapped scripts.

I have a lot of page views to the site like this (many are from an iOS app that retrieves data from the site), and the site gets a lot of visits from search engine spiders, with many old links that I want to pin down and redirect, so it would be nice if I could exclude these spurious 404s from being monitored.  

Can anyone throw any light on this?

Running PW 3.0.94 with a number of modules, but the same behaviour is exhibited on a pretty much vanilla PW install.

Link to comment
Share on other sites

  • ian changed the title to [Solved] Weird 404 behaviour when including/bootstrapping PW from another script

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...