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
- Navigate to Redirects:
- In the sidebar, click
Server Configuration
, then selectWebsite Redirects
orAliases and Redirects
(depending on your Virtualmin version).
- In the sidebar, click
- 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
- Add a Redirect:
- Click
Add a new redirect
or a similar button.
- Click
- Configure Redirect Details:
- Source URL Path: Enter the path to redirect from (e.g.,
/oldpage.html
or leave blank for the entire domain, likewww.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.
- Use full URLs (e.g.,
- 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/*
).
- Source URL Path: Enter the path to redirect from (e.g.,
- Save:
- Click
Create
orSave
to apply the redirect.
- Click
4. Test the Redirect
- Visit the Source URL:
- Open a browser and go to the URL you set to redirect (e.g.,
www.yourdomain.com
oryourdomain.com/oldpage.html
). - You should be automatically redirected to the destination URL.
- Open a browser and go to the URL you set to redirect (e.g.,
- Use Incognito Mode:
- Test in an incognito browser window to avoid cached redirects.
- 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.
- Go to
- Delete a Redirect:
- In
Website Redirects
, select the redirect and clickDelete
. - Confirm deletion. This will stop the redirect immediately.
- In
Common Redirect Examples
- Redirect www to non-www:
- Source:
www.yourdomain.com
- Destination:
https://yourdomain.com
- Type: Permanent (301)
- Source:
- Redirect HTTP to HTTPS:
- Source:
http://yourdomain.com
- Destination:
https://yourdomain.com
- Type: Permanent (301)
- Source:
- Redirect an Old Page:
- Source:
/oldpage.html
- Destination:
/newpage.html
- Type: Permanent (301)
- Source:
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.
- If redirects modify your
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.