rewrite scripts for ZWS and apache