Ugacomp

How can I fix Cloudron domain redirection issues?

Where necessary, you may need to have access to a VPS server so you can follow how to implement the steps in this article.  You can get a cheaper VPS Server from Contabo with 4vCPU cores, 8GM RAM, and 32TB Bandwidth for less than $5.50 per month. Get this deal here now

Table of Contents

Cloud VPS S

$5.50 Monthly
  • 4 vCPU Cores | 8GB RAM

CLOUD VPS M

$15.50 Monthly
  • 6 vCPU Cores | 16GB RAM

CLOUD VPS L

$17.50 Monthly
  • 8 vCPU Cores | 24GB RAM

Cloudron is changing the way website hosting is done. It simplifies the deployment of applications like WordPress with ease, and you don’t have to be an expert in this area to get everything up and running.

Now, there is just one issue we noticed when using Cloudron. After you’ve deployed your application, you’re likely to face domain redirection issues. But what could be the cause of this issue?

In this article, we would like to hold your hand and help you understand how to fix this issue so your Cloudron site can be accessed regardless of the URL prefix used.

How does the concept of domain redirection work?

To get to the bottom of everything, we need to first understand the concept of domain redirection, and then you will be able to fix the Cloudron domain redirection issue you’re facing.

Here is a simple story 🙂

Imagine that you have a physical store located at 123 Main Street. You also have a sign outside your store that says “123 Main Street” to let people know where you’re located.

And again, let’s assume you also own a second building across the street, but it doesn’t have its own address. To help people find your second building, you put up a sign that says “123 Main Street” with an arrow pointing across the street.

This is essentially what domain redirection does for websites. Your website has a domain name, which is like the address of your physical store. But sometimes you may have multiple versions of that domain name, like the following:

  • example.com,
  • www.example.com
  • https://example.com
  • https://www.example.com.

RECOMMENDED READING: How to Point a Domain Name from Namecheap to Contabo VPS

You could be wondering, are these domains the same? The answer is yes and no. And the question is why? All these domains lead to the same website, but they are technically different URLs. The differences in the URLs have to do with how they are formatted and the protocol used to access the website (HTTP vs HTTPS).

Now it’s generally a good idea to configure them for redirection to ensure that all traffic is directed to the same URL, which can help with SEO and avoid any confusion for your visitors.

For example, you might want to set up a 301 redirect from https://example.com to https://www.example.com, so that anyone who enters the non-www version of your URL is automatically redirected to the www version. You might also want to set up a redirect from http to https to ensure that all traffic is encrypted.

RECOMMENDED READING: How to Install WordPress on a VPS Server using Cloudron?

What causes Cloudron domain redirection issues?

By default, Cloudron applications are configured to use one URL which is usually this version: https://example.com. This happens because, during the deployment of an application like WordPress, you’re given the option to either specify a location or leave it empty to use bare domain. See the image below

A location in Cloudron is used to determine where your applications will be hosted and where your data will be stored as the root path. For example, if you choose to name your location www, then your website domain will be prefixed as www.example.com. And when the Let’s Encrypt SSL certificate is installed, the full domain will be https://www.example.com.

RECOMMENDED READING: How to deploy WordPress on a Ubuntu LAMP Server

On the other hand, if we left the location empty, the website domain would just be https://example.com. Now here is the problem! Assuming your actual domain is https://example.com because you left the location empty, and then your website visitors used the other version of your website URL which is www.example.com, do you know what happens? Well, this will lead to a redirection problem and Cloudron won’t understand this URL path which is: www.example.com. And this is because there is only one URL the Cloudron application understands by default which is the https://example.com version.

How do we fix the Cloudron Domain redirection problem?

The first thing we need to do so we can fix the Cloudron domain redirection issues is to make sure our DNS records are set up correctly. When deploying Cloudron on VPS, you need to ensure that appropriate DNS records are set up correctly. Please see the sample DNS setup in the table below:

Record TypeHostnameValue
Aexample.com203.0.113.10
CNAMEwww.example.comexample.com
Amy.example.com203.0.113.10

So, here is how the above DNS records work

  • The A record maps the domain name “example.com” to the IP address of the VPS server where Cloudron is running.

  • The CNAME record specifies that the subdomain “www.example.com” should be an alias for the domain name “example.com“, which can be useful for web hosting purposes.

  • The final A record maps the subdomain “my.example.com” to the same IP address as the domain name, allowing Admins to access your Cloudron management console using this URL my.example.com

RECOMMENDED READING: How to fix Server crashes when running “composer update”

Setting up the appropriate Domain redirection in Cloudron

Now what we need to do is to set up our redirection in Cloudron using the CNAME record with the value www.example.com. This will allow our site visitors to access our website regardless of the URL prefixes they use.

Log into Cloudron Instance Admin Console

Assuming you deployed a WordPress application, you have to log into the management console of your Cloudron instance. This is usually accessed via a URL like this: https://my.example.com. Once you log in, you will be able to see a couple of applications you’ve deployed as seen below in the image

RECOMMENDED READING: How to use Cloudflare on Namecheap Domain Pointed to Contabo

Go to the settings of the application

You need to click on the settings of the application you want the redirection to be set up. Just hover the cursor over the application and you will be able to see the settings icon.

Go to location

Once, you’re inside the settings of your application, go to the location section as seen in the image below;

Add redirection

Finally, under the location section, you need to click on add redirection and make sure you type in www value as seen in the image below;

Make sure you hit the save button and the changes will provision right away.. After adding the redirection, your website will be accessed regardless of the URL prefix used.

For example, if a website visitor types in www.example.com, instead of being shown an error by Cloudron, they will be redirected to https://example.com. Similarly, if they type in example.com or https://www.example.com, they will still be redirected to https://example.com.

That’s it and hope you enjoyed this reading. If you find it meaningful please come back again because we’re always putting more content here. You can also share the link to this article if you like so others can find a solution to this issue. Thank you so much 🙂

RECOMMENDED READING: installer: Could not pull cloudron/base error – Suggested fix

Hire us to handle what you want

Hire us through our Fiverr Profile and leave all the complicated & technical stuff to us. Here are some of the things we can do for you:

  • Website migration, troubleshooting, and maintenance.
  • Server & application deployment, scaling, troubleshooting, and maintenance
  • Deployment of Kubernetes, Docker, Cloudron, Ant Media, Apache, Nginx,  OpenVPN, cPanel, WHMCS, WordPress, and more
  • Everything you need on AWS, IBM Cloud, GCP, Azure, Oracle Cloud, Alibaba Cloud, Linode, Contabo, DigitalOcean, Ionos, Vultr, GoDaddy, HostGator, Namecheap, DreamHost, and more.
 

We will design, configure, deploy, or troubleshoot anything you want. Starting from $10, we will get your job done in the shortest time possible. Your payment is safe with Fiverr as we will only be paid once your project is completed.