It should not have worked on apache as well. wp_head
is too late to make a redirect as there is already some output sent at that point and php will not send the http headers required for the redirection. You need to hook on wp_loaded
or any other hook before output actually happens.