How to Create 301 Redirect in WordPress

How to Create 301 Redirect in WordPress

People create redirects for several reasons. In fact, 99% of redirects are created when the website owners change their URL structures or when they have altered the post slug of a page. Whenever the reason is, redirects are very important as they retain your visitors by leading them from your deleted page to your newly updated page.

The 301 redirect comes into play. In the following, we have listed some simple ways on how to create a 301 redirect by the use of .htaccess, PHP and a redirection plugin.

What is Redirect 301?

The redirect 301 is the most commonly used redirect used by the majority of webmasters. It informs search engines and online visitors when a page has been permanently moved to a new location. It is for this reason that we highly recommend you use this redirect whenever you move your webpages. After all, with a 301 redirect, the rank of your deleted page and any other juice from a search engine are retained.

Redirect a Page Using Redirect 301

Using .Htaccess

.htaccess is a file used by Apache web server to control the website URL rewrite. You can read this page to learn the syntax of .htaccess in the detail.

Generally, a simple redirect looks like,

Redirect 301 /oldpage.html /newpage.html

After save the .htaccess file, the redirection takes into effect immediately.

Using PHP

Also, you can write 2 simple lines of PHP scripts for the redirect as below,

header("HTTP/1.1 301 Moved Permanently");
header("Location /newpage.html"); 

Ensure that the code is placed at the top for it to work correctly. The line that informs “301 permanently moved” is important to advice search engines that the page has been moved.

Using a Redirection Plugin

A WordPress redirection plugin is an easy alternative to PHP script or .htaccess. It comes handy for those who are not well versed with the technical world. One great plugin is the Redirection Plugin. The plugin, besides allowing you to perform a 301 redirect, it also allows you to perform a 307 and 302 redirect. Once the plugin is installed in your site, it will automatically add redirect when you change the URL slug of a post.

Get the plugin from and install it from your WordPress dashboard. After you have installed the plugin, go to Tools >> Redirection.

Redirection Plugin

Input the old URL and the new URL. After that, click “Add Redirection” and the redirection is ready.

Add Redirection

Also, you can read into this list of our reviewed WordPress redirection plugins.