Are you making an attempt to form a redirect in WordPress? Unsure what a redirect is and why it’s important? Well, today I will teach you what a redirect is and the way to produce a redirect in WordPress.
Ready? Let’s start.
What is redirect in WordPress?
Redirect is a way to tell you users browser that the page they want to visit has been moved to elsewhere and the browser will automatically go to the new destination page.
There are different kinds of redirects like 301 redirect, 302 redirect, 307 redirect, etc.
However to stay this text straight forward and helpful, I will solely teach you about the 301 redirects as that’s the foremost necessary.
Let’s take a glance at why it’s necessary.
When does one want a 301 redirect in WordPress?
The main reason behind using 301 redirection is when one deletes some specific page, moves site or moves some specific page and wants to point users to new page instead.
You may like to form a redirect after you delete a post or page in favor of recent content or after coming up with on ever-changing the permalinks of your post or page.
Why? As a result of not making a redirect can cause your users to find a 404 not found error. If you delete any page/post that is indexed in Google search and don’t redirect to any similar or new page/post, you may face some Index coverage issues in Google search console. That will be a bad experience for users, however it may also impact your site’s SEO and hurt your Google rankings.
That’s why 301 redirects become vital.
It permits you to inform search engines and your user’s browser that the page they’re making an attempt to achieve has been moved to a brand new location.
This allows for all of your recent page’s traffic and backlink (SEO) strengths to be transferred on to the new page.
How to redirect in WordPress using Plugins
The easiest way to form and manage 301 redirects is using WordPress redirect plugins. You can use anyone of redirection plugins. Some plugins are discussed below. This enables you to setup redirections without writing a single line of code.
The easiest method to make redirection in your WordPress site is using the Redirection plugin. Install this plugin and activate it. After activation, visit Tools » Redirection to setup your redirects.
Redirection plugin not only solely permits you to setup redirects but also conjointly helps you discover out 404 errors on your WordPress site. You’ll then redirect those URLs to associate applicable destination.
2. Page links to
Sometimes you don’t want to remove or delete post/page but you need to redirect users to another post/page instead. Then you can use this plugin called Page links to. This Page links to plugin add a meta box when you edit a post where you’ll enter the URL address of the new page/post wherever you would like to send your users.
If you use WordPress plugin to make 301 redirects very easily then you must know that it has some minor performance setback. Based on your hosting provider your site may take a little bit longer time to get redirected.
Want Faster redirection?
Okay, you can do so by adding code in your .htaccess file.
How to setup 301 Redirects using .htaccess
Are you using cPanel? Okay, then you can set up 301 redirects using the web server configuration file .htaccess.
Using WordPress? You don’t need to go to the root directory of your site. You can easily edit your .htaccess file if you are using Yoast SEO plugin.
Please note that a tiny low mistake in your .htaccess code will build your WordPress website inaccessible, and it should begin showing Internal Server Error.
That’s why it’s necessary that you just backup your .htaccess file before creating any changes.
Edit .htaccess in root directory
To edit your .htaccess file, you’ll need to go to the cPanel of your site. Open file manager » public_html as the .htaccess file resides in your WordPress site’s root directory.
If you can’t see your .htaccess file there, then click on settings. You will see an option Show Hidden Files(dotted files), just check that box and save.
Now right click on .htaccess file and go to Edit. Add the code given below on the top of your .htaccess file and save it.
Redirect 301 /old-URL/ http://yoursite.com/new-URL/
Edit .htaccess using Yoast SEO plugin
If you are using Yoast SEO Plugin in your WordPress site then go to SEO » tools » File editor and add the code given above in .htaccess file textarea. You may add this on the top.