Scroll Top

How to redirect a page or URL in WordPress?

redirection-301-302-32stepscom

You have backlinks to pages on your site from other websites, which presents an excellent opportunity to increase your visitor numbers. However, if you have previously changed or deleted the URL of these pages for various reasons, these visitors will arrive on your 404 page. To avoid this unfortunate situation, you can consider repairing these links and redirecting your broken URLs to an appropriate location (HTTP 301 redirect). In this article, we will look at when, why and how to perform page or URL redirects on a WordPress-based website. Here are our answers to your questions about “How to redirect a page or URL in WordPress?” :

Contents

1. What do HTTP 301 and 302 mean?
2. When and why do a page or URL redirect?
3. How to redirect a page or URL in WordPress?
4. What are the impacts of a page or URL redirect on SEO?

1. What do HTTP 301 and 302 mean?

For URL redirection, two codes come to the forefront: HTTP 301 and 302.

HTTP 301 is used when a page is permanently redirected to a new page.

On the other hand, a 302 redirect is used when you want to move your page temporarily. Even if your visitors don’t notice the difference between 301 and 302, the search engine spiders take it into account when they index your site.

2. When and why do a page or URL redirect?

The 301 redirect can be used when redirecting from HTTP to HTTPS or when redirecting a domain. For example, if you have acquired domain names with “.com” and “.be” extensions for your site, you can use 301 redirection to redirect your “.be” extension to “.com” instead of creating two sites. This way, visitors who search with both extensions will arrive on the same website.

A 301 redirect allows you to permanently replace pages that you have deleted or changed the link to because you no longer need to operate them on your website.

Alternatively, you can use a 302 redirect for temporary changes such as during A/B testing to improve the user experience on your site, or during campaign periods (for example, when you need to change prices and images at important marketing times, such as Black Friday or the holiday season). Temporary 302 redirection makes it easy for you to do this without losing your SEO authority.

You can also use a 302 redirect if you want to temporarily redirect traffic to another page when you need to update a page on your website.

When you need a permanent or temporary redirection because you are facing the situations mentioned above, you should use URL redirection to prevent 404 errors and avoid SEO damage.

3. How to redirect a page or URL in WordPress?

For this purpose, we can present you two methods. If your computer skills are limited, we recommend that you try the first method we have mentioned below.

The easiest method you can use for a page or URL redirect in WordPress is to install a plug-in. You can choose from free plug-ins like Redirection or 301 Redirects – Easy Redirect Manager, but also paid options like the “Redirect Manager” included in the Yoast SEO premium package.

1. Redirection

This is one of the most downloaded redirect plug-ins. With this free plug-in, you can easily manage 301 redirects and track 404 errors. It can help reduce errors and improve your site’s ranking. Redirect is designed to be used on sites that have between a few and up to thousands of redirects.

For more info and download this plug-in: Redirection

2. 301 Redirects – Easy Redirect Manager

Another popular plugin, 301 Redirects helps you easily create and manage 301 and 302 redirects for your WordPress site.  With the statistics it provides, you can analyze how much your redirects are being used.

Find out more information and download this plug-in: 301-redirects

3. “Redirect Manager”- Yoast SEO

This is a feature of Yoast SEO (a popular SEO plug-in) that you can get with the purchase of the premium annual package. When you move or delete pages, it is possible to automatically create redirects and avoid 404 errors. Read more about it: Redirect manager

Another secure and reliable method is redirection via the .htaccess file:

The htaccess (Hypertext Access) file is a file used by the web server such as Apache, which allows you to make changes to your website settings. With this file, you can make all kinds of changes, authorization and restriction operations.

When a new WordPress website is installed, the .htaccess file is usually automatically added to the website’s root folder and is also usually found in the public_html folder of your website.

If the htaccess file does not exist, right-click on an empty space in the file manager and select “New file”. Then name it .htaccess and click on the “Create” button. Then name it . htaccess and click the “Create” button. Once the file is created, you can now add
code to this file.

*Be sure to make a backup before making any changes to this file.*

Some web hosts, such as GoDaddy, give you the ability to edit website files via the file manager console. If you don’t have this feature, connect to your server using an FTP client such as FileZilla ou CyberDuck.

After locating the .htaccess file in the root directory of your website, check that the file contains text like this:

# BEGIN WordPress

RewriteEngine On

RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

Check it out: https://fr.wordpress.org/support/article/htaccess/

and these contents according to the desired operation:

For a 301 redirect:

Redirect 301 /old-page/  http://www.yourwebsite.com/new-page/

In case you need a URL redirection of several pages or articles :

Redirect 301 /old-page/  https://www.yourwebsite.com/new-page/

Redirect 301 /old-page-2/  https://www.yourwebsite.com/new-page-2/

Redirect 301 /old-post/  https://www.yourwebsite.com/new-post/

For a 302 redirection:

Redirect 302 /old-page/  http://www.yourwebsite.com/new-page/

Redirect 302 /old-post/ https://www.yourwebsite.com/old-post/

Once you have updated the .htaccess file, save it directly from your file management console or use the FTP client (FileZilla or CyberDuck) to transfer the new file to your root folder. Visit the old URL to test the redirection.

As the htaccess file is very sensitive, we recommend you to test your 301 htaccess settings to avoid any negative consequences on your site. You can use this tool to test it: htaccess tester.

4. What are the impacts of a page or URL redirect on SEO?

Occasionally, you may want to change the link structure on your site and you have removed tags that were used in the past. In order for this not to have a negative impact on your SEO ranking, you need to do a redirect.

When used correctly and carefully, a page or URL redirect can be very beneficial for SEO. However, you should carefully consider whether a temporary or permanent redirect is necessary.

As mentioned above, there is a difference between 301 and 302 redirects for search engine spiders. When making updates and changes to your website, you can use the temporary “302” redirect to avoid any loss of page authority and SEO score. The bots will take this code into account and ensure that your SEO score is not affected.

Another point to consider when permanently redirecting a URL is that the content of the redirected page should be as close as possible to the content of the deleted page. Otherwise, if you redirect all redirects to the same page, for example to your homepage, search engine spiders will evaluate this negatively for SEO purposes.

Keep in mind that redirection should only be used when it is 100% necessary. Be very careful when editing the .htaccess file, as a small error can cause your website to crash. Remember to save the .htaccess file before changing its content.

Be sure to read our article on how to modify 404 error pages to avoid losing your visitors: How to design an eye-catching 404 page?

If you found this article useful, please share it. Please contact us at the email address below if you have any questions about it.

Merve_SEHIRLI_NASIR_PhD-32Stepscom
Merve SEHIRLI NASIR, PhD
Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.