I have a controller and action which I'm accessing through a custom URL. The original route is still accessible though at the default location
How can I change this to simulate a "Page not found" when the user tries to access this URL? Is it possible?
If the action handler is used to respond to both URLs, you would first have to detect which URL is being requested (using $this->_request->getRequestUri()). If the default URL is detected I think the easiest way to create a "page not found" would be to use
and set up a controller and action to respond.
This won't actually send an HTTP 404, though. To do that, I think you would have to raise an exception within your action handler. I don't know what the official "zendy" way of doing this is, but this seems to work:
throw new Zend_Controller_Action_Exception('Not Found', 404);