Fix rewrite rule affecting API call