Global.asax is a dotNet solution for IIS. If you have a "common php function" file you can include code like this to execute before anything else and redirect accordingly. Might be easier than the .htaccess solution.