How to make 301 redirect WordPress

Make a 301 redirect in WordPress with an easy-to-follow example. Learn how to easily redirect pages and keep your site's SEO intact.

301 Redirects in WordPress

A 301 redirect is a way to permanently redirect a web page or website to a different location. It's helpful to know how to set up a 301 redirect in WordPress, as it's a common SEO practice. This type of redirect helps search engines understand that the original page has moved and that the new page should be indexed instead.

Creating a 301 Redirect in WordPress

An easy way to create a 301 redirect in WordPress is to use a plugin. There are many plugins available for this purpose, including the popular Redirection plugin. This plugin is free and easy to use, and has many features, such as the ability to monitor 404 errors and track redirects. Once you have installed and activated the plugin, you can begin setting up your redirects. To do this, go to Tools > Redirection in your WordPress dashboard. From here, you can add a new redirect by entering the source URL (the page you want to redirect) and the target URL (the page you want to redirect to). You can also specify the type of redirect (temporary or permanent) and add notes if you want.

Writing 301 Redirects in the .htaccess File

If you don't want to use a plugin, you can also write 301 redirects in the .htaccess file. This file is located in the root directory of your WordPress site and can be edited using a text editor. To add a 301 redirect in the .htaccess file, you will first need to locate it. The easiest way to do this is to connect to your website using an FTP client and then look for the .htaccess file. Once you have located it, you can use a text editor to open the file and add your redirects. For example, to redirect a single page, you can use the following code:
Redirect 301 /old-page.html http://example.com/new-page/
This code will redirect any visitors who visit the page "old-page.html" to "http://example.com/new-page/". Alternatively, if you want to redirect an entire website, you can use the following code:
Redirect 301 / http://example.com/new-site/
This code will redirect all visitors who visit the old website to the new one. Once you have added your redirects, you can save the file and then upload it back to your website. This will activate the redirects and ensure that search engines know to index the new page. By using a plugin or writing redirects in the .htaccess file, you can easily set up 301 redirects in WordPress. This will help you ensure that your website remains up-to-date and that search engines are able to properly index your pages.

Answers (0)