is there a way to redirect a user to another page in CGI?

i tried using:

location: file.cgi
and
print "location:file.cgi";

but I can't seem to let it work.