Let X , Y X, Y be realcompact spaces or completely regular spaces consisting of G δ G_\delta -points. Let ϕ \phi be a linear bijective map from C ( X ) C(X) (resp. C b ( X ) C^b(X) ) onto C ( Y ) C(Y) (resp. C b ( Y ) C^b(Y) ). We show that if ϕ \phi preserves nonvanishing functions, that is, \[ f ( x ) ≠ 0 , ∀ x ∈ X , ⟺ ϕ ( f ) ( y ) ≠ 0 , ∀ y ∈ Y , f(x)\neq 0,\forall \, x\in X, \quad \Longleftrightarrow \quad \phi (f)(y)\neq 0, \forall \, y\in Y, \] then ϕ \phi is a weighted composition operator \[ ϕ ( f ) = ϕ ( 1 ) ⋅ f ∘ τ , \phi (f)=\phi (1)\cdot f\circ \tau , \] arising from a homeomorphism τ \tau from Y Y onto X X . This result is applied also to other nice function spaces, e.g., uniformly or Lipschitz continuous functions on metric spaces.