How do watch what an apache process is doing
May 16, 2017 6:21 AM   Subscribe

A script keeps bouncing me out (and only me!) of certain pages on a website but doesn't appear to be anything to do with the script itself. As far as I can tell the request isn't getting to the script so I'd like to figure out where its going. It has the same issue on the live server as on my local XAMPP install.

I am trying to access eg http://www.example.com/page.php?id=123 but instead get redirected to index.php
If I try to access eg, http://www.example.com/page.php?id=234 that works fine and the page loads as expected.

To debug I made the first line of page.php die();
For pages that work, it does as expected, for ones that bounce me out, they still do so I believe its nothing specific about the id=123 that is causing the redirect. There is nothing in the script that would redirect in this way either.
I have disabled all .htaccess rules and the problem persists.

How can I find out where the request is actually going and what it is doing? If the request actually got to page.php it should exit out and stop there but it doesn't so where could it be going and why? I know at some point the request ends up at index.php, if it goes there directly, why would it do that?

I've never encountered anything like it.
posted by missmagenta to Computers & Internet (5 answers total) 1 user marked this as a favorite
 
Best answer: Have you tried different browsers and/or a clean profile in Firefox? If there was ever a 301 redirect from that URL, some browsers cache that very aggressively.

If you don't need to be authenticated to view that URL, you should also try curl/wget to see what's happening and see the actual returned headers. You can do that in Chrome or Firefox by using the network tool and tell it to preserve the logs so it won't be cleared by the redirect.
posted by skynxnex at 6:47 AM on May 16, 2017 [1 favorite]


Response by poster: Tried in Chrome and no redirect. Guess that explains why I couldn't solve it at a code level!
posted by missmagenta at 6:57 AM on May 16, 2017


apache has access and error logs, the location of which will depend on the particular OS. That should point you in the right direction.
posted by empath at 1:01 PM on May 16, 2017


You want a 302 redirect if it's for a missing ID. 301 is more to indicate "this particular page, which used to exist, now lives over here", hence the aggressive browser caching.
posted by neckro23 at 6:33 PM on May 17, 2017


For future reference, this is exactly the sort of thing that the Network panel in most browser's debugging tools is made for. It will show you if it's serving a cached response or not.
posted by Aleyn at 1:21 PM on May 19, 2017


« Older Why would you fix a meaningless election?   |   Physical exercise for mental strength? Newer »
This thread is closed to new comments.