How to redirect my main domain to a different website

I want it so that when people type in domain X (which is connected through digital ocean) that they instead come to domain Y (which I have set up on webflow) Anyone that can explain easily to me as I am not so experienced. Many thanks!

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Site Moderator
Site Moderator badge
February 15, 2024


The easiest way will be to set a CNAME record to handle the redirect for you.

CNAME stands for Canonical Name and is used to alias one domain name to another. Set the CNAME record’s name or host field to www (if you want to redirect or leave it blank if you want to redirect the root domain ( Then, set the value to the domain Y provided by Webflow. This might look something like

Keep in mind that the DNS will need some time to update, this can take from a few minutes to 48 hours, mainly due to DNS cache.


Site Moderator
Site Moderator badge
February 14, 2024

Heya @emillundvall,

There are a couple of ways to do this,

Method 1: Using A and CNAME Records

If URL forwarding is not available:

  1. Change the A record of Domain X to point to the IP address of the server where Domain Y is hosted (this information is available in your Webflow account).
  2. If you’re using www in your domain (like, then set up a CNAME record for www to point to Domain Y.

Method 2: Using WebService and a Droplet

Let’s assume you are using Apache.

Installing and configuring Apache to set up a redirect involves a few steps. I’ll guide you through a basic setup. This guide assumes you have some access to a server where you can install software and edit configuration files. If you’re not comfortable with command-line operations and server management, you might want to seek assistance from someone who is.

Step 1: Install Apache

The installation process varies depending on your operating system. Here’s how you do it for Ubuntu and CentOS, two common Linux distributions.

For Ubuntu:
  1. Open a terminal.
  2. Update your package lists: sudo apt update
  3. Install Apache: sudo apt install apache2
For CentOS:
  1. Open a terminal.
  2. Update your packages: sudo yum update
  3. Install Apache: sudo yum install httpd

Step 2: Start Apache and Enable it to Run on Boot

For Ubuntu:
sudo systemctl start apache2
sudo systemctl enable apache2

For CentOS:

sudo systemctl start httpd 
sudo systemctl enable httpd

Step 3: Configure Apache for Redirection

You’ll need to edit the Apache configuration files. Typically, these are located in /etc/apache2 (Ubuntu) or /etc/httpd (CentOS). The exact file to edit can vary. It could be httpd.conf, apache2.conf, or a site-specific file under sites-available.

  1. Open the relevant configuration file with a text editor, like nano or vim. For example:
sudo nano /etc/apache2/sites-available/000-default.conf
  1. Add the following lines to set up a redirect from Domain X to Domain Y. You can place these lines inside the <VirtualHost *:80> block if one exists, or at the end of the file.
<VirtualHost *:80>
    Redirect permanent /
  1. Replace with your original domain and with the domain you want to redirect to.

  2. Save the file and exit the editor (Ctrl + X, then Y, then Enter for nano).

Step 4: Restart Apache

To apply the changes, restart Apache.

For Ubuntu:
sudo systemctl restart apache2
For CentOS:
sudo systemctl restart httpd

Step 5: Testing the Redirect

After restarting Apache, test the redirect by visiting Domain X in your web browser. It should automatically redirect you to Domain Y.

Additional Tips:

  • If you have a firewall enabled, ensure that HTTP traffic is allowed (port 80).
  • If you’re using HTTPS (port 443), you’ll need to set up SSL certificates and configure Apache to handle HTTPS requests. This is more complex and typically involves editing the <VirtualHost *:443> block in the Apache configuration.
  • Always back up configuration files before editing them.
  • If you encounter any issues, check Apache’s error logs for clues. These are typically located in /var/log/apache2/error.log (Ubuntu) or /var/log/httpd/error_log (CentOS).

Remember, server and network configurations can vary widely, so some steps may need to be adjusted to fit your specific environment.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel