Let X, Y be realcompact spaces or completely regular spaces consisting of G δ-points. Let φ be a linear bijective map from C(X) (resp. C b (X)) onto C(Y) (resp. C b (Y)). We show that if φ preserves nonvanishing functions, that is, f (x) = 0, ∀ x ∈ X, ⇐⇒ φ(f)(y) = 0, ∀ y ∈ Y, then φ is a weighted composition operator φ(f) = φ(1) • f • τ, arising from a homeomorphism τ : Y → X. This result is applied also to other nice function spaces, e.g., uniformly or Lipschitz continuous functions on metric spaces.