Sometimes you need to create redirects from additional domain to a specific landing page or from an old article to a new one. We recommend that you create the redirects with a WordPress plugin or with a PHP code. One of the recommended plugins is the Redirection plugin.
You can do more advanced regular expression (regex) redirects with this plugin but in this guide, we are going through two of the most common and simple redirects.
Redirect the Old Article to a New One
If you change your URL slug from one of the site's article or page, you should create a redirect from the old URL to a new one. That way the old URL doesn't return a 404 error. Let's say for example that your old URL is https://example.net/old-article
and you need to create a redirect to https://example.net/new-article
.
Write your old URL slug (/old-article
) to Source URL and the new URL slug (/new-article
) to Target URL. Save your new redirect by clicking the Add Redirect button.
Redirecting Additional Domain to a Landing Page
Sometimes you want to create a landing page and use a specific additional domain redirect with it. You might have a main domain example.net
and an additional domain example.com
. You want to create a redirect from example.com
to https://example.net/example
.
Write your whole URL (https://example.com
) to the Source URL and add the landing page URL slug (/example
) to the Target URL. Save your new redirect by clicking the Add Redirect button.
You can see all created redirects in the list view on the plugin page and can also modify them later if needed.
Remember to test and make sure your redirects are working like they should. It is recommended to also test the redirects in all forms for example with a www and non-www URLs.
Redirects in Multisite
If you are using a multisite setup, utilizing the Redirection plugin requires a bit of extra work, but it is still possible. The plugin can be installed in the multisite, either to the network or to individual sub-site(s). Regardless of the installation method, each sub-site has its own redirection rules.
Redirecting an Additional Domain in Multisite
If the domain to be redirected has not been defined for use within the multisite, and only functions as an extra additional domain, the first step should be to create a redirect on the HTTP server (Nginx). This ensures that the traffic from the additional domain is targeted to the correct sub-site within the multisite. See instructions for creating an nginx redirect here.
Once the nginx redirect is in place, you can use the Redirection plugin to create redirects normally, as described above. The resulting redirection path is as follows:
example.com -> nginx -> example.net -> Redirection -> example.net/desired-page
Nginx can also be used to redirect a desired URL directly to a specific landing page, but maintaining redirects made with the Redirection plugin is more user-friendly than maintaining redirects implemented on the HTTP server. You can use the method you deem best for creating redirects.
Special Characters (Ä, Ö, Å) in a Domain
If your website's domain contains special characters (like Ä, Ö, Å) or other national characters, the domain must be converted into Punycode format using an IDN converter so that the Redirection plugin can process them. For example, the domain viestintävirasto.fi
translated into Punycode format is xn--viestintvirasto-7kb.fi
.
Converting a domain to Punycode can be done conveniently, for instance, with Traficom's IDN converter.
More Information About Redirection Plugin
Please read more specific instructions from the plugin documentation.