Currently you cannot set a 301 redirect in Deployments. For maximum SEO a 301 redirect is beneficial. It’d be cool to see 301 (and 302 too if possible) Redirects supported in Deployments.
@matt-replit has a great doc on custom domains and does talk about adding www and non-www, however, this creates a ‘duplicate’ content scenario in the eyes of Google etc.