Redirect domain

Hi all.

I know we cannot edit nginx.conf as it gets overwritten everything we upgrade the version, but I need to redirect a domain hosted in my MIAB instance to another domain.

For example:
From www.example.com to www.foo.com. Does anybody have a workaround for such a thing?

Thanks!

1 Like

I think there may be a hidden feature in MiaB to help with this, but I don’t use it so I haven’t explored it. And I’m not sure if it is possible with DNS entries. I probably should actually figure out a better solution.

However, since nobody has replied, here is one way that can work.

You can use a simple HTML file to perform the redirect:

<!DOCTYPE html>
<html>
<head>
<title>example.com</title>
<meta HTTP-EQUIV="REFRESH" content="0; url=//www.example.org/" />
</head>
<body>
<p>Redirecting...</p>
</body></html>

Note that this is not permanent, so unless users update their links, they will continue to load the page, plus some devices or apps may not read the HTML headers. Also note that permanent redirects are permanent.

It is possible to get a local nginx configuration per domain. I learned about this last week. Create a file example.com.conf in /home/user-data/www where you can set the redirect. Don’t include the server {} part form the nginx config only return 301 https://foo.com$request_uri;

I haven’t tested this so try first…