Setting Up Redirects in Virtualmin

This guide explains how to set up URL redirects in Virtualmin, such as redirecting www.yourdomain.com to yourdomain.com or redirecting old pages to new ones. Redirects help manage website traffic and improve user experience, and can be configured without root access.

Prerequisites

  • Virtualmin Access: You must have login credentials for the Virtualmin control panel.
  • Domain Configured: The domain for which you want to set up redirects must be set up in Virtualmin.
  • Website Enabled: Ensure the website feature is active for your domain (usually enabled by default).

Step-by-Step Guide

1. Log in to Virtualmin

Access the Virtualmin control panel with your credentials. Select the domain you want to manage from the dropdown menu in the top-left corner.

2. Access Redirect Settings

  1. Navigate to Redirects:
    • In the sidebar, click Server Configuration, then select Website Redirects or Aliases and Redirects (depending on your Virtualmin version).
  2. View Existing Redirects:
    • The redirects page will show any existing redirects for your domain. You can add, edit, or delete redirects from here.

3. Create a New Redirect

  1. Add a Redirect:
    • Click Add a new redirect or a similar button.
  2. Configure Redirect Details:
    • Source URL Path: Enter the path to redirect from (e.g., /oldpage.html or leave blank for the entire domain, like www.yourdomain.com).
    • Destination: Specify where to redirect to (e.g., https://yourdomain.com or /newpage.html).
      • Use full URLs (e.g., https://yourdomain.com) for external redirects.
      • Use relative paths (e.g., /newpage.html) for internal redirects.
    • Redirect Type: Choose the type:
      • Permanent (301): For permanent changes, good for SEO.
      • Temporary (302): For temporary redirects.
    • Include Subpaths: Check this if you want to redirect all subpaths (e.g., /old/* to /new/*).
  3. Save:
    • Click Create or Save to apply the redirect.

4. Test the Redirect

  1. Visit the Source URL:
    • Open a browser and go to the URL you set to redirect (e.g., www.yourdomain.com or yourdomain.com/oldpage.html).
    • You should be automatically redirected to the destination URL.
  2. Use Incognito Mode:
    • Test in an incognito browser window to avoid cached redirects.
  3. Check Redirect Type:
    • Use a browser developer tool (e.g., Chrome DevTools > Network tab) to confirm the redirect type (301 or 302).

5. Manage or Delete Redirects

  • Edit a Redirect:
    • Go to Website Redirects, click the redirect you want to edit, modify the settings, and save.
  • Delete a Redirect:
    • In Website Redirects, select the redirect and click Delete.
    • Confirm deletion. This will stop the redirect immediately.

Common Redirect Examples

  • Redirect www to non-www:
    • Source: www.yourdomain.com
    • Destination: https://yourdomain.com
    • Type: Permanent (301)
  • Redirect HTTP to HTTPS:
    • Source: http://yourdomain.com
    • Destination: https://yourdomain.com
    • Type: Permanent (301)
  • Redirect an Old Page:
    • Source: /oldpage.html
    • Destination: /newpage.html
    • Type: Permanent (301)

Additional Tips

  • SEO Considerations:
    • Use 301 redirects for permanent changes to maintain search engine rankings.
  • Test Thoroughly:
    • Verify redirects work for all intended URLs, especially if using wildcards or subpaths.
  • Backup .htaccess:
    • If redirects modify your .htaccess file, back it up using File Manager before making changes.

Common Troubleshooting

  • Redirect Not Working: Ensure the source URL matches exactly, including protocol (http vs. https). Check for conflicting redirects in .htaccess.
  • Redirect Loop: Verify that the source and destination URLs are different. Contact support if the issue persists.
  • Feature Not Available: If you can’t access redirect settings, contact support to verify your account permissions.

For further assistance, contact our support team via the ShopWhizzy Helpdesk.

Categories: DNS
thumb-up thumb-down