Internet works based on HTTP protocol between a web server and clients like browser on your computer. There could be many errors happen during this communication. In order to understand the status of the communication, web server returns carious status codes called HTTP status codes. 301 is one such HTTP status code. This is a server side status code, returned by a web server when the requested URL by the client is reached by redirecting the user agent. The user agent is normally a web browser or a search engine crawler trying to access a web page. 301 status code is not shown in the browser window and the user agent is automatically redirected to another resource by the server. Hence, it is generally called server side 301 redirect setup.
Why You Need 301 Redirect?
301 redirect is very important for both SEO purpose and good user experience.
- You have deleted the old page and created a new page.
- Merged two pages together.
- Transferred the domain to another name.
- Moved content to another location like subdomain or subdirectory.
- Updated the page URL.
In all the above cases, users trying to access old URL from links and bookmarks can be redirected using 301. Similarly, search engines can determine the new page value in search results similar to the old page.
Add 301 Redirects in WordPress
There are multiple ways to setup 301 redirect in WordPress.
- Using free plugins like Redirection to manage simple and regex redirects or use premium plugins like Yoast SEO.
- Manually add redirects using .htaccess file. You have to login to the server’s root directory using FTP or use File Manager in cPanel to access htaccess file.
- Using redirect manager apps from cPanel hosting to add re-directives in htaccess file.
Using Redirection Plugin
The plugins manage redirects within WordPress setup and will not add any htaccess entries. Therefore, we recommend using Redirection or similar plugin to manage 301 redirects in WordPress.
- Install and activate Redirection plugin in your site.
- Go to “Tools > Redirection” menu.
- Click on “Add New” and enter your source and destination URLs.
- Save the changes to add 301 redirect.
You can setup single page redirect or use regex to setup logical redirection in bulk.
Setup Redirect in WordPress with Rank Math Plugin
Though Redirection is a perfect plugin, you can use popular SEO plugins like Rank Math and Yoast SEO for setting redirects in WordPress. Here, we will show you the example of Rank Math.
- After installing and activating the free Rank Math plugin, first go to “Rank Math > Dashboard” section and enable “Redirections” module.
- After that, go to “Rank Math > General Settings” menu. In this section, you can enable auto redirection type as 301 and enable “Auto Post Redirect” option. This will help to setup automatic 301 redirects whenever you change the URL of your posts.
- If you want to manually add a redirect, go to “Rank Math > Redirections” menu. Click “Add New” button and provide the details for adding a redirect from your old page to a new page.
Both Redirection and Rank Math plugins allow you to temporarily disable redirection for troubleshooting purposes. However, you can test whether redirect is working or not from the setup page with Redirection plugin while you manually need to test with Rank Math.