ThisCalculator

Everyday

Set Up Domain Redirects in Webmin & Virtualmin

Updated · Standard formula, shown below

This guide shows you how to set up domain redirects in Webmin and Virtualmin, so you can forward one domain or subdomain to another URL—useful for moving a site, merging domains, or forcing www vs non-www. You’ll need administrative access to your Webmin/Virtualmin server and the ability to edit virtual server settings.

What You’ll Need

  • Root or administrative access to Webmin (usually via https://your-server:10000)
  • Virtualmin module installed and configured (it’s included in most Webmin installs)
  • The domain(s) you want to redirect must already be set up as virtual servers in Virtualmin, or at least have DNS pointing to your server
  • Basic understanding of HTTP redirects (301 permanent vs 302 temporary)

Step-by-Step

  1. Log in to Webmin – Open your browser and go to https://your-server-ip:10000. Enter your root or admin credentials.
  2. Open Virtualmin – In the left sidebar, click on Virtualmin to enter the Virtualmin module. If you don’t see it, make sure Virtualmin is installed (look under Unused Modules).
  3. Select the source domain – In the Virtualmin menu, click Virtual Servers and choose the domain that you want to redirect from (e.g., old-domain.com). If the domain isn’t listed, you’ll need to create it first via Create Virtual Server.
  4. Go to the Redirects page – In the Virtualmin menu for that server, click Redirects under the Services section. This opens the “Redirects” page where you can manage URL forwarding.
  5. Add a new redirect – Click Add Redirect (or the “Add” button). You’ll see fields for Destination URL, Type, and optionally Path.
  6. Enter the destination URL – In the Destination URL field, type the full URL you want to forward to, including http:// or https://. For example: https://www.new-domain.com.
  7. Choose the redirect type – Select Permanent (301) for a permanent redirect (recommended for SEO when moving a site) or Temporary (302) if you’re testing or the change is short-term.
  8. Set the path (optional) – If you want to redirect the entire domain and all subpaths, leave the Path field empty or set it to /. To redirect only a specific folder (e.g., /blog), enter that path. For most full-domain redirects, leave it blank.
  9. Save the redirect – Click Create or Save. Virtualmin will add the redirect configuration to the web server (Apache or Nginx).
  10. Test the redirect – Open a new browser window and visit the old domain (e.g., http://old-domain.com). You should be taken to the destination URL. If it doesn’t work, check the troubleshooting section below.
  11. Repeat for other domains – If you have multiple domains to redirect (e.g., old-domain.net and old-domain.org), repeat the steps for each virtual server.

Common Mistakes

  • Forgetting to include the protocol – The destination URL must start with http:// or https://. If you omit it, the redirect may fail or go to an unexpected path.
  • Using a relative path as destination – Virtualmin expects an absolute URL. Don’t enter /new-page; use https://example.com/new-page.
  • Redirecting to the same domain – This creates a loop. Make sure the destination is a different domain or a different subdomain.
  • Not clearing browser cache – After setting a 301 redirect, your browser may cache the old response. Test in incognito mode or clear cache.
  • Editing the wrong virtual server – Double-check that you’re in the correct domain’s settings. A common mistake is adding the redirect to the destination domain instead of the source.

Tips

  • Use 301 for permanent moves – If you’re permanently moving a site, a 301 tells search engines to update their index. 302 is for temporary changes and may not pass SEO value.
  • Redirect www to non-www (or vice versa) – To avoid duplicate content, set up a redirect from www.example.com to example.com (or the opposite). This is a common use case.
  • Test with curl – From your local machine, run curl -I http://old-domain.com to see the HTTP status code. A 301 or 302 indicates the redirect is working.
  • Back up your configuration – Before making changes, consider backing up the virtual server configuration via Virtualmin’s Backup feature.
  • Use wildcard redirects for subdomains – If you need to redirect all subdomains, you may need to set up a wildcard virtual server or use a server-wide redirect in Apache/Nginx, which is beyond Virtualmin’s per-domain redirect feature.

Troubleshooting

  • Redirect not working – First, check that the domain’s DNS points to your server. Use dig old-domain.com or nslookup to verify. If DNS is correct, check that the virtual server is actually using the redirect by looking at the web server config (under Apache or Nginx in Virtualmin).
  • Getting a 404 instead of redirect – This often means the redirect wasn’t applied. Go back to the Redirects page and confirm the redirect is listed. If not, re-add it and save.
  • Redirect loops – If you see “too many redirects,” you likely have a redirect pointing back to the same domain or a chain. Remove any conflicting redirects and ensure the destination is different.
  • HTTPS issues – If your server uses SSL, make sure the redirect is set to use https:// in the destination, and that SSL is properly configured for both the source and destination. Check the SSL certificate covers the source domain.
  • Changes not taking effect – Virtualmin may need to reload the web server. In Virtualmin, click Refresh or use the Apply Configuration button. You can also restart Apache/Nginx from the Webmin > Servers section.
  • Redirect only works for the homepage – If you want the entire domain to redirect, ensure the path is empty or set to /. If you entered a specific path, only that path will redirect.

Frequently Asked Questions

Can I redirect a domain that isn’t a virtual server in Virtualmin?

No, you need to create a virtual server for the domain first, even if it’s only for redirecting. You can create a minimal virtual server with no website content and then add the redirect.

What’s the difference between a 301 and 302 redirect?

A 301 is permanent and tells search engines to replace the old URL with the new one. A 302 is temporary and indicates the redirect may change later. Use 301 for permanent moves.

Can I redirect a subdomain to a specific folder on another domain?

Yes, you can set the destination URL to a full path, like https://example.com/subfolder. The path field in the redirect is for the source path, not the destination.

Will redirects affect my email settings?

No, domain redirects only affect web traffic. Email settings are separate. However, if you’re redirecting the entire domain, you may want to update email addresses as well.

How do I remove a redirect?

Go to the Virtualmin Redirects page for that domain, find the redirect in the list, and click Delete. Then apply the configuration.

Can I set up a redirect to a URL with a query string?

Yes, you can include a query string in the destination URL, such as https://example.com/page?utm_source=old. Virtualmin will forward to that exact URL.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.