WordPress: Create 301 Redirects

WordPress: Create 301 Redirects

WordPress itself does not offer the possibility to create redirects with the WordPress Admin, therefore you have to either use a plugin or create all your redirects with .htaccess. This post is about exactly these two points. First you will learn how to create a redirect with the .htaccess and then a useful plugin which will take the work out of it.

The .htaccess solution

If you have access to your FTP server, you can create redirects manually using your .htaccess. To do this you need to add the following things to your .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/new.php$ https://domain.com/old/ # target is a .php file
RedirectMatch 301 ^/new-2/$ https://domain.de/old-2/ # target is a path
</IfModule>

In the example we redirect once from https.//domain.com/alt/ to /new.php. We also redirect from https://domain.de/old-2/ to /new-2/. You can copy the individual lines completely, paste them right under there and edit them. The changes should take effect immediately after saving.

The WordPress Plugin Solution

The easiest way to create your continuations is to use a plugin. Also because you don't need FTP access and you can create your redirect with just a few clicks directly in the WordPress Admin. The plugin which I use for redirects, also for example to hide partner links:

Redirection WordPress Plugin

You can find the plugin directly in the WordPress Admin under Plugins and Install. Once installed and activated, you will find all settings under Tools and Redirection and also your links, if you have created them there.

You can create your redirect by clicking on Add new. There you enter the origin and your desired destination. In our example from above the whole thing would look like this:

Redirection WordPress Plugin

Here we redirect again from https://domain.de/old/ to /new.php. The destination can be any address, even addresses that do not link to your website. So you can create a group for affiliates with the help of the groups and store your affiliate links there.

In the options you can also activate a log for everything. Once activated, the executed redirects will be logged including IP address, if you want to. The IP address can also be masked so that you can't do anything with it and the GDPR leaves your wallet alone.

You know a better method (especially .htaccess) to create a redirect? Share it with pleasure!

Did you find this article valuable?

Support Kevin Pliester by becoming a sponsor. Any amount is appreciated!