Change is the only permanent thing in life. This is so true with every sphere of human life including those that revolve around technology. Given the fact that there are no permanent URLs to websites, you are at liberty to change the URL of your website. Before doing this, you should spare a thought about your visitors who should not be left groping in the dark when they key in your previous URL in the browser. You should ensure that they land in the correct place.
How can you achieve this objective?
Your necessity to change your WordPress Permalink structure and migrate to a completely new domain is made possible through a 301 redirect. Using 301 redirects, you can effortlessly redirect all the web traffic from one URL to another, without adversely affecting the user experience or the SEO strategy.
Having said this, a 301 redirect is a permanent redirect which permits visitors and search engines to migrate to a different URL than what was originally keyed in the browser or was selected from the results page of a search engine.
After understanding the significance of 301 redirects, it is time to learn about the various cases in which this feature can be applied to your WordPress site.
- When you wish to alter your permalink or slug structure: In this scenario, you can use the 301 redirect to redirect URLs which were earlier associated with your previous slug or permalink structure to a new one.
- When are you planning to migrate your WordPress site from HTTP to HTTPS: For website, if you enable SSL certificate for HTTPs, you need to migrate from the HTTP URL to HTTPS. In doing so, it is mandatory for you to add the 301 redirects so that you reroute all the unsecured data and traffic to the SSL version of your site.
- When you are looking to rename your website with a different URL: When a necessity to completely change the domain name of your WordPress site arises, you can implement the 301 redirects. In such a case, a 301 redirect will come handy in rerouting all the website traffic generated by your old domain to the new one.
- When you wish to change the URL of a page or a single post: WordPress sites usually and automatically redirect all the old posts that were previously associated, to the new one. But you can steer clear of instances when the 301 redirect feature is not automatically activated. In such circumstances, it is highly recommended that you use a manual 301 redirect.
- When you are integrating multiple posts into one single post:his is another scenario which demands the implementation of a 301 redirect. To consolidate some sub-standard posts on your website into one monster post so as to generate more traffic, you can take the help of a 301 redirect. A 301 redirect can help you to merge all the small posts into one giant post.
- When your organization has multiple URLs: If your business operates through multiple URLs and if it becomes quite hard for you to manageable then it is time you implement the 301 redirects. Through a 301 redirect, you will be in a favourable position to reroute all the traffic to the main website from the various URLs.
The Multiple Ways in Which You Can Add 301 Redirects
By now, you have clearly understood the various scenarios in which a 301 redirect can help you seamlessly migrate from one URL to another. A 301 redirect can be added to your WordPress site either by using a free Redirection plugin or via the .htacess file of your site.
Let us look at these two alternatives by following certain simple step-by-step guides supported by screenshots.
1st Option: How Can You Add 301 Redirects Using the Free Redirection Plugin?
These instructions help you to manage the 301 redirect feature straight from your dashboard when you are using the Free Redirection Plugin. This can be the easiest and most convenient option for WordPress users to go ahead with.
- Step 1: After you complete installing and activating the plugin, you should make this selection: Tools -> Redirection
- Step 2: The below instructions help you create a 301 Redirect:
- You need to paste the original URL in theSource URL box
- You should then paste the new URL (the new destination of your traffic) into the Target URL box
- Then, you should click the option:Add Redirect
Below is the pictorial representation of the simple steps that will help you add a 301 redirect to your WordPress site.
After you add some redirects by following the earlier-mentioned series of steps, you can edit, disable or delete them from the same platform. See the text that is highlighted in red in the below image.
2nd Option: How can you Add 301 Redirects to Your WordPress site via the .htaccess File?
All the users of a WordPress site are aware of the fact that the .htaccess file is the basic configuration file for your server. Here, you will be making use of this file to add a number of redirects to your site, by appending some simple code snippets.
The following 3 steps need to be taken before you add the code snippet that is similar to the type of 301 redirects you wish to add.
- Step 1: You need to connect to your site either through File Transfer Protocol (FTP) program or through the cPanel File Manager.
For you to connect to your site through the FTP program, you need to secure your credentials from your host. Alternatively, you can use cPanel’s in-built File Manager tool. Since most of the users are comfortable with cPanel for the primary reason that it is simple to use, these chronological instructions will help you connect to your site using the cPanel File Manager.
As a preliminary step, you need to log in to your cPanel dashboard. After logging in, you need to locate the File Manager option listed under the Files option.
You should then select Settings button (remains at the top right) on that opened window.
After that, choose the Document Root Directory option. A drop-down menu appears. From there, you need to pick the target site that should add the 301 redirects. Here, you should be careful to check the Show Hidden Files (dotfiles) checkbox.
- Step 2: Locate the .htaccess file that is housed in the root directory.
After that, the File Manager opens allowing you to view a copy of the .htaccess file of your site. Keep your eyes fixed on the top of the listing for you to locate this file.
- Step 3: Take the complete back up of your .htaccess file.
You should be mindful of the fact that your .htaccess file is the gateway to your entire server. Since you cannot afford to let your site suffer a downtime even for a short time, you should always play safe by backing up the original .htaccess file before you start making any changes to it.
Here is the screenshot that will show you the process of backing up your .htaccess file.
Backing up your .htaccess file is simple. You just need to right-click the file and then select the Download option and you are all covered. In the event a small typo error creeps in, you will be well-equipped to undo the damage caused by it by simply activating the Load button. This action will upload the backed up copy for things to move normally.
- Step 4: You need to edit the .htaccess file and select the Redirect code snippet that matches the type of 301 redirect you wish to add.
After you are sure that you have downloaded the backup copy of the .htaccess file on your computer, you can proceed with the next step of actually adding the relevant redirect code.
For you to complete this step, you need to right-click the .htaccess file and then choose the Edit option. This is what you will see after you perform the above action.
There may be instances of a popup appearing on the screen after selecting the Edit option. But you don’t have to worry about them. You need to simply click the Edit option again for the popup to open an editor. This is how your screen will look like with the editor opened.
With the completion of this step, you can add relevant 301 redirect codes in the .htaccess file as per your 301 redirection requirement for web page or website.
3rd Option: 3 Instances That You Will Encounter While Redirecting Old URLs to New URLs via 301 Redirects
If you are looking to redirect old URLs to new URLs, you will have to be prepared to solve three different scenarios. Below is the description of these instances along with the significance of 301 Redirects which can support your cause of migrating from the old URL to the new URL.
- Scenario 1: If you wish to redirect a single post or page
In the event you want to redirect a single page or post, you need to use the below instruction format:
Redirect 301 /old-url https://yourdomain.com/new-url
Here, you need to understand that the /old-url should be the one that succeeds the first “/”. For instance, given that your old URL is https://xyzdomain.com/301-redirect and the new one is https://xyzdomain.com/301-redirect-guide, you need to use this format:
Redirect 301 /301-redirect https://xyzdomain.com/301-redirect-guide
- Scenario 2: If you want to redirect your old Permalink Structure to the New Permalink Structure
If you are looking to redirect your old Permalink Structure to a new Permalink Structure, you need to first check out the exact code that you need to use. Given the fact that this scenario is tricky to implement, the choice of the right code will unveil the below two parameters:
- Your previous (old) Permalink Structure
- Your New Permalink Structure
If you want to move to the Post Name permalink structure, you need to generate the befitting code. In order to attain this objective, you can check out the permalink helper called Yoast. Through this tool, you can generate redirects from your old permalink structure to the /%post name%/ permalink structure.
Alternatively, you can take the assistance of a professional developer who will use Regex (Regular expression) to come up with the right code for this redirection to take place.
- Scenario 3: How can you redirect an entire domain name to a new domain?
301 redirects are perfect to help you move your WordPress site to a completely new domain, without much sweat. All you need to do is to use the below-described code snippet.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [L,R=301,NC]
Once this code is executed, you will be able to set up a 301 redirect on the old domain. Post this, you can automatically and effortlessly divert all the old domain traffic to the new domain.
However, this instruction comes with a caveat. You need to be sure that you are replacing olddomain.com with your existing old domain and newdomain.com with the actual name of your new domain.
With this repository of instructions by your side, you can safely change the URLs on your WordPress site using 301 redirects. So, the next time you are looking to alter any links on your website, all you need to do is to set up a 301 redirect. Thus, setting up a 301 redirect will nip off all the instances of losing out on your hard-earned web traffic. In addition to effortlessly diverting all your web traffic to a new URL, you will also start enjoying better search engine rankings through 301 redirects.
Closing Thoughts
The above article speaks volumes of the fact that there are many ways in which you can add the 301 redirects to your WordPress site. While using a WordPress plugin simplifies the entire process, you can also use the .htaccess file. All in an attempt to ensure that your URL structure is neat and organized.