redir script for handling ngingx rewrites