Of course, this should be in your Response class of your framework. If you use (one) front controller - my case - you have such a method in the front controller, and therefore it can be called from anywhere.
Update: The front script controller handles all requests (or most of them). The basic structure:
<?
For example, common work involves the ability to manage security permissions for all URLs in an application in one place, logging, connecting to a database, etc. Then you delegate the detailed work to certain scripts depending on the URL. Ok, where to put the redirect method? If you put it in any of the shared libraries included in the first part of the script or in common functions, it should be available for any method called later, especially in scripts that process specific URLs. Hope this clarifies.
I have not read all the details, but this link may help .
source share