By geropalacio
Hi guys! I have 3 domains that I want to use for my personal website. These are 3 different combinations of my name + last name and I want them all to point to my web server. Let’s say I want to use fullname.com for my website, but I also want to redirect requests from shortname.com and middlename.com to fullname.com.
On my account I’ve created all 3 domains to make them point to my droplet. But the problem is that, if I browse to shortname.com, I do not get redirected to fullname.com. How can I achieve these? I understand I cannot add a CNAME record as those map subdomains to hostname.
Any idea? Is there something am I missing?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You’ll need to set up the redirects on the web server itself. Assuming you are using Apache, it would look something like this:
<VirtualHost *:80>
ServerName shortname.com
Redirect permanent / http://fullname.com
</VirtualHost>
<VirtualHost *:80>
ServerName middlename.com
Redirect permanent / http://fullname.com
</VirtualHost>
<VirtualHost *:80>
ServerName fullname.com
# The full configuration for your site....
</VirtualHost>
Check out this tutorial for more information on setting up redirects with example for both Nginx and Apache:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.