ian Posted March 22, 2018 Share Posted March 22, 2018 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 More sharing options...
Robin S Posted March 23, 2018 Share Posted March 23, 2018 Related issue: https://github.com/processwire/processwire-issues/issues/259 Ryan said: Quote You can set what page should be used for the $page API variable with the $config->externalPageID setting. Set this to the ID of the page you want it to use, in your /site/config.php file. 2 Link to comment Share on other sites More sharing options...
ian Posted March 24, 2018 Author Share Posted March 24, 2018 Thanks @Robin S. That makes perfect sense. I found a way round it for logging but good to know the reasoning behind it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now