How to Redirect a Page or URL in WordPress (2 Methods) (2024)

Do you need to redirect a page or URL in WordPress?

When a user follows a link to your website that leads to a page that doesn’t exist, they will see an error message. This poor user experience can be frustrating for your visitors and prevent them from becoming clients or customers.

In this article, we’ll show you how to fix broken links by redirecting pages and URLs in WordPress.

How to Redirect a Page or URL in WordPress (2 Methods) (1)

Why Redirect a Page or URL in WordPress?

Links let you connect related pages on yourWordPress website. They help visitors navigate your site and allow search engines to easily find and index your content.

However, broken links lead to a URL that doesn’t exist on your website. When this happens, a frustrating 404 ‘Page Not Found’ error message appears.

How to Redirect a Page or URL in WordPress (2 Methods) (2)

This offers a poor user experience and may negatively impact your SEO.

It may be that the web page was deleted, the page’s URL was changed, or the person who created the link simply typed the wrong URL.

Luckily, you can easily track 404 errors and redirect the URLs to pages that do exist.

With that being said, let’s take a look at how to redirect a page or URL in WordPress. We’ll cover two methods:

  1. Creating Redirects Using All in One SEO (AIOSEO)
  2. Creating Redirects Manually by Editing .htaccess (Advanced)

    Method 1: Creating Redirects Using All in One SEO (AIOSEO)

    The simplest way to redirect pages and URLs in WordPress is using theAll in One SEO(AIOSEO) WordPress plugin. It’s thebest SEO plugin for WordPressand offers a powerful Redirection Manager addon that makes it very easy to set up redirects.

    Note:You will needAIOSEO Proto use the redirection manager. There is also afree versionof AIOSEO, but it doesn’t include 301 redirects.

    The first thing you need to do is install and configure the AIOSEO Pro plugin on your website. For step-by-step directions, see our guide onhow to set up All in One SEO correctly.

    After that, you will need to activate the Redirect Manager addon. Simply go toAll in One SEO » Redirectsand click the ‘Activate Redirects’ button.

    How to Redirect a Page or URL in WordPress (2 Methods) (3)

    Finally, you will need to click on the ‘Settings’ tab to select a redirect method.

    We recommend the ‘PHP’ option because it is the simplest and doesn’t require technical configuration of your web server.

    How to Redirect a Page or URL in WordPress (2 Methods) (4)

    Now you are ready to redirect your WordPress pages. You can do this using the AIOSEO Redirection Manager or the WordPress content editor.

    Creating a Redirect From the AIOSEO Redirection Manager

    While you are still on the All in One SEO » Redirects page, you can navigate back to the ‘Redirects’ tab. This page lets you manage your redirects and add new ones.

    To add a new redirect, you need to add the post slug of the URL that isn’t working. The slug is the part of the URL that comes after your website’s domain name.

    Let’s look at an example. The full URL of a post or page looks like this:

    https://example.com/old-coffee-link-is-broken/

    In this case, the post slug is the last section of the URL:

    /old-coffee-link-is-broken/

    You need to type or paste the post slug of the broken link in the ‘Source URL’ field like this:

    How to Redirect a Page or URL in WordPress (2 Methods) (5)

    Tip: You can redirect multiple source URLs to the same target URL. Simply click the ‘Add URL’ button to add an extra ‘Source URL’ field.

    Next, you need to enter the post slug of the existing page that you wish to redirect the URL to. You need to type or paste this into the ’Target URL’ field.

    How to Redirect a Page or URL in WordPress (2 Methods) (6)

    Alternatively, you can simply type part of the page’s title and AIOSEO will show a list of matching posts and pages.

    Once you click on the correct post, the slug will be entered for you.

    How to Redirect a Page or URL in WordPress (2 Methods) (7)

    The last step is to choose a redirect type.

    Make sure that the ‘301 Moved Permanently’ redirect type is selected and then click the ‘Add Redirect’ button.

    How to Redirect a Page or URL in WordPress (2 Methods) (8)

    Now, you can scroll down to view a log of the redirects you have created.

    The ‘Hits’ column shows the number of people who visited the redirected link, and there is a toggle option to enable or disable individual 301 redirects.

    How to Redirect a Page or URL in WordPress (2 Methods) (9)

    Creating a Redirect From the WordPress Content Editor

    You can also use All in One SEO to redirect a published post or page while you are editing it.

    When you scroll to the bottom of the WordPress editor, you will find an AIOSEO Settings section. You need to click the ‘Redirects’ tab.

    How to Redirect a Page or URL in WordPress (2 Methods) (10)

    Here you will find the same redirection options that we covered above. The source URL has been filled in for you, and you need to add the target URL.

    After that, make sure the ‘301 Moved Permanently’ redirect type is selected, and then click the ‘Add Redirect’ button.

    A useful All-in-One SEO feature is that if you change a post’s permalink while editing it, AIOSEO will automatically redirect the old URL to the new one.

    Method 2: Creating Redirects Manually by Editing .htaccess

    You can also redirect a page or URL without using a plugin. To do that, you need to manually add code to your website’s .htaccess file. This method is not suitable for beginners because a small mistake can break your website.

    Before using this method, we strongly recommend making a backup of your .htaccess file.

    After that, you can make changes to the file using All in One SEO’s editor tool or edit it directly using FTP or your hosting provider’s file manager.

    Editing .htaccess Using All in One SEO’s .htaccess Editor

    TheAll in One SEOplugin offers an easy way to edit your .htaccess file. However, you will needAll in One SEO Proto use the .htaccess editor.

    Once you have installed and configured AIOSEO, simply navigate to theAll in One SEO » Toolspage. Next, you should switch to the ‘.htaccess Editor’ tab.

    How to Redirect a Page or URL in WordPress (2 Methods) (11)

    This page will show the contents of your .htaccess file. You need to paste your redirect code at the bottom of the file after the ‘# END WordPress’ line.

    Here is a simple redirect where we are trying to send a user visiting an old post to a new post.

    RewriteEngine OnRedirect 301 /thisistheoldurl/ http://yoursite.com/thisisthenewurl/

    Hosted with ❤️ by WPCode

    Make sure you change the old post and new post URLs.

    Once you have done this, click the ‘Save Changes’ button at the top of the page to update the .htaccess file with the new code.

    Editing .htaccess Directly

    You can also edit the .htaccess file directly without the need for a plugin. To do this, you need to connect to your website using anFTP client or your hosting provider’s file manager.

    You will find the .htaccess file in your website’s root directory. If you don’t see it there, then refer to our guide onwhy you can’t find .htaccess file on your WordPress site.

    You may be able to edit the file using the file manager’s Edit feature. Otherwise, you can download .htaccess to your computer and edit it using atext editorlike Notepad.

    You should paste the following redirect code at the end of your .htaccess file after the ‘# END WordPress’ line.

    RewriteEngine OnRedirect 301 /thisistheoldurl/ http://yoursite.com/thisisthenewurl/

    Hosted with ❤️ by WPCode

    Don’t forget to change the old post and new post URLs.

    How to Redirect a Page or URL in WordPress (2 Methods) (12)

    Make sure you save your changes, and if necessary, upload the .htaccess file back to the server.

    Now, you can test your redirect to make sure it is redirecting properly as you intended.

    Expert Guides Related to Redirection in WordPress

    Now that you know how to redirect pages and URLs, you may like to see some other guides related to redirection in WordPress:

    • Beginner’s Guide to Creating 301 Redirects in WordPress
    • How to Find and Fix Broken Links in WordPress (Step by Step)
    • How to Easily Track 404 Pages and Redirect Them in WordPress
    • How to Redirect Your 404 Page to the Home Page in WordPress
    • How to Properly Move WordPress from HTTP to HTTPS (Beginner’s Guide)
    • How to Do a Full Site Redirect in WordPress (Beginner’s Guide)
    • How to Easily Move WordPress to a New Domain (Without Losing SEO)

    We hope this tutorial helped you learn how to redirect a page or URL in WordPress. You may also want to see our guide on the difference between 302 and 301 redirects, or our expert pick of the best WordPress redirect plugins.

    If you liked this article, then please subscribe to ourYouTube Channelfor WordPress video tutorials. You can also find us onTwitterand Facebook.

    How to Redirect a Page or URL in WordPress (2 Methods) (2024)

    References

    Top Articles
    Latest Posts
    Article information

    Author: Carlyn Walter

    Last Updated:

    Views: 5953

    Rating: 5 / 5 (70 voted)

    Reviews: 93% of readers found this page helpful

    Author information

    Name: Carlyn Walter

    Birthday: 1996-01-03

    Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

    Phone: +8501809515404

    Job: Manufacturing Technician

    Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

    Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.