Changed launch order. Check for special commands before serving static/dynamic content.
Also K forget to fclose his file, which could lead to issues later