Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How can I redirect traffic from an existing subdomain to a new subdomain?
Our company recently went through a rebrand resulting in a change of domain.
We previously had users accessing our app (Ubuntu droplet with NodeJS) via app.olddomain.com.
I have successfully updated the DNS to have the droplet be served on app.newdomain.com instead (which is working completely fine), but would like anyone who mistakenly goes to the old access point (app.olddomain.com) to be redirected to the new subdomain (app.newdomain.com).
DNS is being managed through DigitalOcean, and both domains are purchased through Google Domains.
I have tried a CNAME, but I am seeking a true redirect than an alias.
One option I have considered is hosting a LAMP droplet on app.olddomain.com and use Htaccess to do a 302 redirect, but that seems silly hosting and paying for a droplet just for that purpose.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×