If you’ve bought an aged domain and have a number of backlinks pointing to it, you will find that a good part of them are linking directly to the domain name or the website’s homepage. Accounting for the domain’s old age, backlinks may be pointing to different versions of your website (http and https as well as www and non-www versions of your website).
In order to check whether you have backlinks to all 4 versions of the website, you may use the Ahrefs’ “Best-By-Links” report. It must be noted that Ahrefs is a paid tool, but there’s also an option to get a 7 day trial for $7.
To make sure the redirects are placed at the domain level, you have to set the canonical domain. Setting the canonical domain means setting up your preferred version of the website (i.e. https without www). This way, you ensure that all links including those pointing to the http and www versions of your website will pass on link juice to the specified canonical domain.
Next, while this tackles the issue of backlinks pointing to different versions of the domain, there’s also the issue of the backlinks pointing deep into the website pages, which at the initial stage of purchasing the domain will all show up as broken backlinks.
At this point, you have two alternative courses of action. One of them is recreating the old pages or, in other words, replacing the content in order to take advantage of the page’s inbound backlinks. Alternatively, you can redirect each of the above-mentioned missing pages to the single most relevant page on the website. This could be an alternative page with highly similar content – a page with a description of the domain acquisition or simply the homepage of the website, in case neither of these two options are viable.
In order to find all pages that need to be created or redirected, one must use the Ahrefs’ “Best-by-links” report. This report shows the top pages with inbound external links. So, when all these pages are either recreated or redirected, one could say that they have taken advantage of the entire domain’s link juice.
How to Set Up a 301 Redirect for a WordPress Website
The two most common ways of setting up redirects are through:
- Web server configuration – server-side redirects.
- Content Management System (CMS) – WordPress redirects.
Please note that setting up URL redirects in a CMS has benefits and drawbacks.
It’s much more accessible for people without a development or system administration background, but it has several drawbacks:
- Redirects set up within the CMS and on the web server level can co-exist, leading to confusion and mistakes;
- When there are problems with the CMS, the redirects might stop working;
- These redirects are slower, as the CMS needs to be loaded for every redirect.
Therefore, setting up URL redirects on your web servers is always recommended. Only use CMS redirects when there is no other suitable way to redirect URLs.
Web Server 301 Redirects Setup
For server-side redirects, the most common method is to edit your web server configuration files.
Nginx and Apache are two of the most popular web servers that deliver web pages to users’ browsers. In our case, from a hosted WordPress site.
This article will dive only into Apache configuration as it’s the most used for WordPress hosting. And even NGINX-based servers can implement a hybrid model that will allow using the Apache magic file – .htaccess.
So, as you have already guessed, the most common method to set up server-side redirects is to edit your site’s .htaccess file.
Let’s take a look at the steps that you have to take:
1. Find and back up the .htaccess file
You can find and edit the .htaccess file using the file manager of your hosting provider’s control panel or by accessing your website’s files by FTP protocol.
The above instruction is for FTP access, but you can adapt it to your particular case, depending on how you access the files.
- Log in to your server using an FTP client such as FileZilla. You can set up or find FTP access credentials in your web hosting account;
- Find the .htaccess file. Usually, it’s located in the root folder of your website, the /public_html or /www/html folder.
- Since the CMS is WordPress, this folder will also contain [wp-admin, wp-content, wp-includes] folders;
- If you don’t see the file, you must enable FileZilla’s show hidden files option. Checking this option will force FileZilla to show hidden files and directories. Before connecting to your server, click on the “Server” tab in FileZilla’s menu bar and click Force Showing Hidden Files in the dropdown menu.
- This step is crucial. The .htaccess file could affect the functionality of your website if not handled correctly. Before making any changes to this file, make sure you have backed up the original by right-clicking the file name and selecting “Download”;
- Once you save the file to your machine, make another local copy, rename it (.htaccess.bk, for example), and keep this renamed file in a safe place;
- Now, open the original one – you can use the standard text editor Notepad (Windows) or TextEdit (Mac), and then you can follow the next part – Add redirects and upload/update the new version of your .htaccess file.
2. Add redirects and upload/update the new version of your .htaccess file.
You will observe that the opened file already contains some data, do not delete or edit any lines, otherwise you risk breaking your website.
Also, you have to add any of the above redirect snippets before the existing data so that the file begins with your newly added code.
- 301 redirecting a single URL
This redirect is helpful when several backlinks point to different homepage variations, or you want to redirect a former page with backlinks to a current live page with relevant content.
To set up a 301 redirect, you’ll need to specify the old and new URL locations with a syntax structure that looks like this:
Redirect 301 /old-url/ https://my-domain.com/new-url/
Note: /old-url/ is just the part that comes after my-domain.com. For the new URL, you should input the full URL. You can specify the redirect type (301 or 302) by adding the redirect status code before the URL location rules.
For example, the old homepage had several paths: ‘my-domain.com/main.php’, ‘my-domain.com/site/index.php’, or ‘my-domain.com/index.html,’ but your current site has a more friendly homepage URL without showing the file name – ‘my-domain.com’.
Or, there’s an old article, ‘my-domain.com/old-article-name/’ that you don’t want or can’t recreate keeping the old URL structure, so you want to redirect it to ‘my-domain.com/new-article-name/’.
For this particular example, in order to set up a permanent 301 Redirect, we have to add the following lines to the .htaccess file:
Redirect 301 /main.php https://my-domain.com/
Redirect 301 /site/index.php https://my-domain.com/
Redirect 301 /index.html https://my-domain.com/
Redirect 301 /old-article-name/ https://my-domain.com/new-article-name/
- 301 Redirecting several URLs
If you want to redirect more than one page, you can use the RedirectMatch directive. It allows including a regular expression in your redirection criteria.
This redirect is helpful when you have many backlinks that match a pattern, so you don’t have to set up a redirect rule for every link.
To set up a 301 redirect, you’ll need to specify the old URL pattern and new URL locations with a syntax structure that looks like this:
RedirectMatch 301 /old-url/(.*) https://my-domain.com/new-url/
For example, your aged domain has many pages with backlinks from a former forum website. Thus, many links will have the same pattern my-domain.com/forum/post-1/page-1/, my-domain.com/forum/post-4/page-5/, etc. The pattern here is that all links start with the /forum/ slug. So we want to redirect all these links to our new page – my-domain.com/forum-info/.
For this particular example, in order to set up a permanent 301 Redirect, we have to add the following line to the .htaccess file:
RedirectMatch 301 ^/forum/(.*) https://my-domain.com/forum-info/
This snippet will instruct the server to redirect all links that start with /forum/ slug to the new page /forum-info/. So no matter what follows after the second slash (/), it will be redirected to the /forum-info/ page.
After adding all the necessary snippets, you can save your .htaccess file and upload it to your server via FTP, overwriting the original one.
Set Up Redirection in WordPress by Using a Plugin
For setting up redirects in WordPress, you can use a plugin. The most popular is the Redirection plugin. You can find and install it from https://redirection.me/. It has excellent support documentation.
For creating new redirects, reach out to our Tech support team via our Contact Form.