rewrite index.cgi in c