By "nothing should do anything special," do you mean that it should not be redirected?
So, Q really, if the user accesses the URL for the PHP file directly, should he redirect if it is processed as usual through AJAX? (to really clarify, you mean through the url, not through the include statement?)
Answer: You cannot. Artefacto mentions the HTTP_X_REQUESTED_WITH header - required, but it can be faked.
Is it really so bad that the user directly accesses the URL? If the answer is "OMG Yes!" then maybe something is wrong with how the system is designed. Redesign it until it replies, "In fact, I suppose it won't hurt."
James
source share