Added a couple of lines to prevent app from redirection to $app_domain domain (good for "localhost").