Forward all subdomain URLS to specific URL on primary domain

May 28, 2018 490 views
DNS System Tools Ubuntu 16.04

Here are my Droplet/server details:

Ubuntu 16.04.3 x64 / 8 GB Memory / 160 GB Disk

My issue:

I am currently trying to forward all URLs of my subdomain to a specific URL on my primary domain.

Example: alpha.example.com/* needs to be forwarded to example.com/specific-url

NOTE: I need to forward both alpha.example.com AND all the URLs on alpha.example.com (alpha.example.com/1, alpha.example.com/2, etc) to example.com/specific-url.

All URLs being forwarded will go to ONE (aka the same) URL on the primary domain. I also need to forward the subdomain "homepage" to the same page as well.

I am reorganizing my website layout structure and I am removing my subdomain sites and replacing them with specific pages on my primary domain.

I checked with Cloudflare (using to manage DNS) and it looks like you can do this with page rules but they want to charge $1 a month per page rule which seems a bit ridiculous. I'm hoping there is some way to do this within the DigitalOcean interface (possibly with .htcaccess?).

Consider me a noob when it comes to this type of stuff as I'm still learning my way around.

Thanks in advance!

Be the first one to answer this question.