How Create a Redirect URL in WordPress?

How Create a Redirect URL in WordPress? - WordPress - Lorelei Web

Updating the links on your WordPress site can be a simple theoretical task. However, if you get the process wrong, visitors could end up on a separate, unintended page, or worse—a broken link. This has a lot of effect on your search engine rankings, traffic figures, and overall authority.

WordPress offers a range of easy-to-use plugins to redirect URLs to those who are unfamiliar with the method. This will help you make sure that your URLs are routed correctly.

In this guide, I’ll teach you how to effectively redirect the WordPress URL and the key types of URL redirects and when to redirect the URL.

But let’s talk first about what the URL redirect is and how it functions!

What is a Redirect URL?

URL redirect (also referred to as URL forwarding) is a way to render a web page available under different URL addresses.

If the browser redirects the URL, a page with a new URL will be opened instead of the original one.

There are many ways to redirect a URL, and each has its own purpose—see let’s the three most popular forms.

1. 301 Redirects 

For instance, the 301 redirect is irreversible , taking place on both the browser and server sides. It is the most common and efficient redirect since it passes on the ‘link juice’ of an existing URL.

As a result, search engines are more likely to identify and index this form of redirect, making it the preferred option in most cases.

2. 302 Redirects 

On the other hand, a 302 redirect is temporary and can only be used if you intend to switch back to the original URL in the future.

Let’s assume, for example, that you are redesigning your website. When you update your website, you can use 302 to redirect users to another domain for a short time.

3. Refresh Meta

Web browsers also provide a meta-refresh feature that helps you to redirect the URL to a new page without modifying the server.

You can set the amount of time it takes to redirect, but by doing so, you also run the risk of making your visitors wait to get to their next page destination, potentially creating a bad user experience.

Although there are other types of redirects that you might use, these three are the ones you’ll see most often—especially 301 redirects.

Why Use a URL Redirect

You may wonder why you would ever need to redirect the URL to your own website.

In the previous section, we addressed some of the factors, although there are others too, such as:

  • Preventing broken links – Broken links occur when the destination page has been transferred or removed or when a firewall prevents access to your website. When users follow a broken connection, they will see a 404 error message in the window. According to SEO expert Bruce Clay, redirects are the most SEO-friendly way to repair broken links.
  • Linking several domains: If you manage several websites, you can redirect several domains to the same destination without affecting your SEO. Redirects allow search engines to see which page is a canonical source when several pages show the same content. This is also great for preventing duplicate material fines.
  • Protecting your privacy – By using the power of HTTPS, you can protect your website from aggressive attacks such as phishing or malware delivery. It would be best if you redirected users and search engines to the HTTPS page or to the server-side resource 301 HTTP redirect.

No matter what purpose you’ve got to redirect users to a new page, it’s important that you take the time to connect it properly. The incorrect redirect will take your visitors to the home page instead of the intended one, resulting in unnecessary redirects and more.

How to Redirect a URL in WordPress (2 Methods)

How to Redirect a URL in WordPress (2 Methods)

WordPress has two key strategies to redirect a URL—you can either use a plugin or edit a .htaccess file.

Let’s get started with a classic WordPress approach.

1. Using the WordPress plugin

Redirect plugins will ensure broken links lead to the correct page on your web. This way, if a visitor clicks a broken link, they will be redirected to a new page that increases your website’s reputation and prevents your search rankings from falling.

Although there are many great plugins to choose from, such as 301 Redirects, I prefer the Redirection plugin.

Redirect is impressive for many reasons—not only has it been around for over a decade, but it also helps first-time users to build and manage redirects without any previous knowledge of Apache or Nginx web servers.

As Redirection provides full support for regular expressions, you can allow redirect patterns to fit any number of URLs and redirect all of them to the target URL. You can also watch for changes to the post or page permalinks and then automatically redirect to a new URL.

Once you have installed and enabled the plugin, click the Tools > Redirection menu in your WordPress admin field, and run through the Setup Wizard measures.

When you’re done, go to the Redirects tab on the same admin page. This will show a list of existing redirects. To add a new redirect, press the Add New button.

You’ll see a bunch of fields pop up, including:

  • Source URL – This is the URL you are redirecting from. E.g., if you are redirecting from https://myexample.com/old-post, your source URL would be/old-post.
  • Query Parameters – You can precisely match parameters (the default option) or disregard all parameters. With the latter, does the/old-post match my/old-post? Search=1.
  • Goal URL – This is the URL to which you are redirecting. E.g., if you are redirecting from https://myexample.com/old-post to https://myexample.com/new-post, your target URL would be/new-post.
  • Community: This helps you to organize your redirects into groups.

Clicking on the gear icon will give you some additional choices for matching redirects. After these fields have been filled in, click Add Redirect, and the plugin will create the redirection law.

2. Edit Your .htaccess File

The ‘hypertext access’ file—otherwise known as .htaccess—is a distributed server configuration file that allows you to set server configurations for a specific directory. It is used by the server when a request is made to the directory.

Although not as easy as downloading a plugin, this powerful approach helps you to set up websites, folders, and URL redirects. You will need the following skills and tools before you start:

  • A suitable FTP client, e.g., Cyberduck or FileZilla
  • Access to the server of your website, typically called www or public HTML.
  • The skills needed to use FTP.

First, you need to fire your FTP client and enter the root directory of your WordPress account. Check the directory for the .htaccess file, then open it with your regular text editor.

Once .htaccess is open, place your cursor at the end of the file and enter the redirection rules, depending on your needs.

To redirect a single page to a different page, add the following rule:

Redirect 301/old-page.html to http://www.example.com/new-page.html

To redirect a complete domain name to another domain, enter the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www.)oldsite.com$ [NC]
RewriteRule ^ http://newsite.com%{REQUEST_URI} [L,R=301]

This snippet sends users from the old address page to the same new page—for example, from www.oldsite.com/post to www.newsite.com/post. Don’t forget to change your placeholders to your own domains and sites.

Save your changes and test your latest redirects when you’re done!

Conclusion

In this tutorial, I showed you how to redirect your WordPress URL using two methods:

  • Install a plugin to redirect.
  • Delete the .htaccess file.

URL redirecting is not a day-to-day job, but still very usual. As such, doing it right means that users can have a smooth experience on your web, and your search engine rankings won’t drop for items like broken links or redundant content.

Do you have any more questions about URL redirection? Please feel free to reach out in the comments section below!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.