How to Do a 301 Redirect in WordPress
Performing your WordPress website or web page redirect is one of the most prominent practices. Therefore, it’s become urgent for you when you change or delete the URLs of your website and web pages.
You may need to change the URLs of your website any day. You must let the Google bots know about the change. Otherwise, they can’t crawl your web pages. Furthermore, you need to perform redirection to let visitors know the new location of your web pages.
For example, let’s say you have a website related to golf products, and you have been doing great with your website over the last few years. But, at a point, you may need to delete a page or post from a website for some reason, but you know the webpage gets a lot of visits and performs better on the SERP or Search Engine Result Page.
Here, you can redirect the webpage to a new webpage address. Doing so will let you know the search engine about the content that has already existed. Moreover, once people use the older URL for diving into the webpage, they will redirect to the new webpage address.
Another important fact about the 301 redirects is that they are permanent redirects. This means that when you redirect any existing web pages to the new URLs, the web pages are shifted towards the new destination.
However, there is also a 302 redirect, regarded as the temporary redirect of the websites and webpages.
What Are the Most Prominent Ways to Do 301 Redirect
There are many effective ways to perform the task of 301 redirects. But, this blog will show you the easiest and most effective ways of 301 redirecting.
Before, let’s clear one more important thing. You can redirect the web pages or website. So, if you want to redirect some of the web pages of your website, you can do so. Besides, if you transfer the entire domain, you can perform.
So, first of all, you should have a solid idea about what (web pages or websites) you want to redirect.
The methods that you will cover below are:
- Using the redirection WordPress plugin.
- Use the .htaccess file.
Nonetheless, if you want to redirect some of the web pages of your website, it will be better if you use the WordPress redirection plugin.
To do so, first, you need to install the Redirection WordPress plugin to your website. Once you have installed the code, follow the below steps.
- Tools.
- Redirect.
- Add new.
You will have to put information like source URL, query perimeter, target URLs, and group.
Make sure you put the target URLs you want to redirect your webpage, and the source URLs mean the current URLs of the webpages. Then, you need to click the ‘Add Project’ to complete the task.
Now, we will show you how you can redirect an entire domain with the help of the .htaccess file.
First, you must access the .htaccess from the server’s cPanel dashboard. You will find the .htaccess file on the root folder of your website under ‘File Manager. Then, the next step will be to backup your .htaccess file so that you can’t lose any in some cases.
To backup, the .htaccess file, left click on this and click ‘Download’ to download the file on your computer.
Now, you have to edit the .htaccess file to insert some codes in it. So, first, click on the .htaccess file and then click ‘edit.’
Use the following code,
oldsite.com/example-post goes to newsite.com/example-post.
You must replace the ‘example’ with your website’s domain name. After doing this, don’t forget to save the edited .htaccess file and you are all set.