Skip to main content

AfriForum Web - Domain redirects to URLs

In some cases, AfriForum requires that a domain is redirected to a full URL. An example of such an instruction is:

skorseff.co.za to resolve and redirect to https://afriforumjeug.co.za/eff-weier-wittes-toegang-tot-tuks-afriforum-jeug-eis-skorsing/

In order to achieve this, we need to complete a few configuration steps across to technologies, 1) DNS and 2) Web Server

Lets start with the DNS configs.

Step 1: Ensure that the domain in question (in our example, skorseff.co.za) has its nameservers set to point to either the Digital Ocean. Then, log into Digital Ocean - https://cloud.digitalocean.com

Step 2: Configure (either in AfriForum Digital Ocean account or Lonely Viking Digital Ocean account) a new domain by loggined in and then, select "Create" and choose "Domains/DNS"

image-1695884181104.png

Step 3: Once the domain is set up in the relevant Digital Ocean account, ensure you point the A record to the server where the web server that owns the redirect logic (in our case, this is the AfriForum Web Server with IP address 13.244.226.183).

Step 4: Remember to configure a CNAME record for the "www" of this domain to resolve to the same default A record value (use the "@" designation for this).

image-1695884295970.png

Note: these configurations usually take a short while to propagate, so move on to the next steps before confirming your settings above are correct

Now, the Web server configs

As you know, the DNS server is responsible for resolving the domain name (also referred to as a host name in some cases) to an IP address. Once the DNS resolution occurs, the server to which the IP address is allocated to needs to direct the traffic based on the domain name (this is called a "reverse proxy" setup).

In our case, we use Nginx within RunCloud to achieve this.

Step 1: Log into the Lonely Viking RunCloud account - https://manage.runcloud.io/

Step 2: Navigate to the relevant server (in our case, the AfriForum Web server, with IP address 13.244.226.183)

Step 3: Locate the 'AfriForum redirects' web application within "Web Applications"

image-1695884527506.png

Step 4: Navigate to the "Domain Name" and the click "Add Domain"

image-1710316480085.png

Step 5: Add a new "Alias" domain and ensure you select all relevant options (such as "Enable www for this domain / subdomain" etc) - also confirm your DNS requirements as shown in the big red block below

image-1710317212697.png

Step 6: Now that a new domain alias has been associated with the "AfriForum redirects" web application, navigate to the "SSL/TLS" page, locate your new domain and click on the ellipses "..." and click "Deploy SSL/TLS"

image-1710316668053.png

Step 7: Next, on the "Deploy SSL/TLS Certificate" page, set your security certificate settings as follows:

  • Select "Let's encrypt" as your SSL provider
  • Choose "dns-01" as your "Authorization method"
  • Choose "AfriForum_DigitalOcean_2" as your "DNS Provider API Key"
  • Select "Live" as your "Let's Encrypt Environment"
  • Toggle "HSTS & Server Side Redirection" on "HTTP to HTTPS Redirection "

Then, select "Deploy SSL"

image-1710316726753.png

Step 8: Navigate down to the "NGINX Config" and open the "afriforum-redirects.location.root.redirect-conf.conf" file

image-1695884653558.png

 

Step 9: Add an additional line on the NGINX config file that configures your desired redirect, see below:

if ($host = 'diekaplyn.com') {
    return 302 $scheme://afriforumteater.co.za/#program;
}

Note: if you're domain includes "www" then ensure you add a second record for NGINX config as follows:

if ($host = 'www.diekaplyn.com') {
    return 302 $scheme://afriforumteater.co.za/#program;
}

Step 10: Click save

Step 11: TEST!