I have created a page on a WordPress site called AJAX which lives here: domain.com/ajax/ This page is used for AJAX calls. What I want to prevent is direct access to it, so basically allow JS to call the page but if someone types in the url and tries to access it on its own then they will get a 404 (basically making it as though the page doesn't exist)
The page has its own template file so can have a nice bit of PHP to detect this, but what would that code be? Thanks.