runningWordPress websiteWhen encountering a situation where you need to redirect multiple domains to one main domain name. Whether it's for SEO optimization, to unify your brand image, or to avoid user confusion, it's important to set up the redirects correctly.
Why do I need multiple domain redirects?
1. Harmonization of brand image
A unified brand identity avoids user confusion and ensures that all visitors are accessing the same website, regardless of which domain name they are using.
2. SEO optimization
Search engines like websites with consistent content. If the same website has multiple domains without redirects, search engines may see it as duplicate content, which can affect rankings.
3. Avoiding user confusion
Users may have questions when they visit different domains but see the same website content. With redirects, you can ensure that users visit the correct domain.
How do I set up a multi-domain redirect?
Method 1: Use .htaccess file
Users with Apache servers can modify the.htaccess fileto set the redirection.
- Access to the root directory of the site Use an FTP client or hosting control panel to access the root directory of your WordPress website.
- Edit the .htaccess file Find the .htaccess file in the root directory. If that file is not there, create a new one.
- Adding redirection rules Add the following code to the .htaccess file:
RewriteEngine On
# Redirect old domain to new domain
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com$
RewriteRule ^(. *)$ http://new-domain.com/$1 [R=301,L]
- commander-in-chief (military)
old-domain.com
replacing your old domain name.new-domain.com
Replace yournew domain name. This code will permanently redirect all requests from the old domain to the new domain.
Method 2: Use a WordPress plugin
For those unfamiliar with the code, a WordPress plugin can be used to simplify the redirection setup.
- Install and activate the plugin Log in to your WordPress backend and navigate to "plug-in (software component)" > "Installation of plug-ins", search for "Redirection" plugin and install it to activate it.
- Setting up redirection In the WordPress backend, navigate to "Tools" > "Redirection" and click "Add New Redirection".
- Source URL: Enter the path to the old domain name (e.g.
^/.*
(indicates all paths). - Target URL: Enter the new domain name (e.g.
http://new-domain.com/$1
). - Click the "Add Redirect" button to save the settings.
- Source URL: Enter the path to the old domain name (e.g.
Method 3: Setting through the control panel
Users who use the control panel can set up redirection through the panel.
- Login to the panel Log in using your hosting account.
- Find the "Domains" section In the "Domains" section, click "Redirection".
- Add Redirect On the Add Redirect page:
- Type: Select "Permanent (301)".
- Redirect: Select the old domain name.
- Redirect to: enter new domain name.
- www redirect: select the appropriate option (usually "redirect or not").
- Click the "Add" button to save the settings.
caveat
1. Ensure that redirection rules are accurate
Incorrect redirection rules can result in visitors and search engines not being able to access your website correctly. Therefore, it is important to make sure that the redirection rules you set up are accurate.
2. Check the SSL certificate
If your new domain has an SSL certificate (https) enabled, make sure that the redirection is also using thehttps. Example:
RewriteRule ^(. *)$ https://new-domain.com/$1 [R=301,L]
3. Test redirection
After the setup is complete, visit the old domain name through different browsers and devices to confirm whether the redirection to the new domain name is successful.
reach a verdict
By setting up multiple domain redirects correctly, you can effectively unify your brand image, optimize SEO, and avoid user confusion. Whether it's by modifying an .htaccess file, using a WordPress plugin, or setting it up through a panel, redirection is a relatively simple yet very important process. Follow the steps in this article to ensure that your multi-domain redirection is set up correctly and provides a better experience for your website visitors.