Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
30 Million+
Websites using our plugins
20+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Create a Redirect in WordPress (Ultimate Guide)

Ever clicked an old link to one of your own posts and landed on a 404 error page? That usually happens because the URL changed, but a proper redirect wasn’t set up.

Fixing it takes a couple of minutes, and it doesn’t involve any code. Most people use an SEO plugin for this, but you can also add redirects yourself in your site’s .htaccess file.

In this guide, we’ll walk through both, so you can send old links to the right page and keep the search rankings that page earned.

How to create a redirect in WordPress

What Is a WordPress Redirect?

In WordPress, a redirect sends your website visitors and search engines from one URL to another. Redirects are often used to fix broken links, replace outdated URLs, or point an old URL to a new one.

They also tell search engines that your content has moved, so you can pass the search authority (link juice) from an old page to a new one.

Example of how a redirect works

There are a few different types of redirects that every WordPress site owner must know:

  • 301 Moved Permanently: Use this when a URL has changed permanently, such as after changing a permalink, moving or merging content, deleting a page and replacing it, or switching from HTTP to HTTPS. You should also use a 301 redirect when moving your site to a new domain. It passes the original page’s SEO value to the new URL.
  • 302 Found: Use this when the change is only temporary, such as during website maintenance, a limited-time campaign, or while a page or product is temporarily unavailable.
  • 410 Gone: This isn’t a redirect. Instead, it tells search engines that a page has been permanently removed and won’t be coming back. It’s the right choice when you delete a page that doesn’t have a suitable replacement.

For most WordPress websites, a 301 redirect is the right choice because most URL changes are permanent.

How to Create a Redirect in WordPress With a Plugin (Easy Method)

The easiest way to create a redirect in WordPress is with a plugin. For most websites, we recommend the free 404 to 301 – Redirect Manager plugin because it lets you create custom redirects and track broken links from one dashboard.

At WPBeginner, we use All in One SEO for redirection though because it’s the SEO plugin we use and it comes with a Redirect Manager. Most Pro versions of popular SEO plugins, including Yoast SEO and Rank Math, include one too.

However, for this tutorial, we’ll use the free features in 404 to 301 because they provide everything most WordPress websites need.

First, install and activate the 404 to 301 – Redirect Manager plugin. If you need help, then see our guide on how to install a WordPress plugin.

After activation, go to 404 to 301 » Redirects and click the ‘Add Redirect’ button.

Click the Add Redirect button in the 404 to 301 plugin

In the popup that appears, enter the old URL in the ‘Source URL or pattern’ field.

Next, choose where you want to send visitors in the ‘Target URL’ field. You can redirect them to a custom URL, an existing page on your site, or choose not to redirect the URL.

Next, select a ‘Redirect Status.’ For most URL changes, you’ll want to use ‘301 – Moved Permanently (SEO)’, which tells browsers and search engines that the page has permanently moved.

If you need a different type, then you can pick one from the dropdown menu.

Choose a redirect status in the 404 to 301 plugin

When you’re ready, simply click ‘Create Redirect’. Your redirect is now active, and anyone visiting the old URL will be automatically sent to the new destination.

After creating a redirect, you should test it to make sure it sends visitors and search engines to the correct page.

Simply visit the old URL in your incognito or private browsing window to see if it redirects you to the new page instead of showing a 404 error. This prevents the browser cache from showing your old page instead.

You can also use a free online redirect checker tool, like Redirect Checker, to confirm your redirect is returning the correct HTTP status code, such as 301 Moved Permanently.

How to Create Redirects Manually With .htaccess (Advanced)

If you don’t want to use a redirect plugin, then you can create redirects by editing your website’s .htaccess file. This method is best for advanced users because even a small mistake can cause your website to stop working.

Note that this method only works if your host runs Apache or LiteSpeed. Standalone Nginx has no .htaccess file, so if your host runs Nginx, then use the plugin method above or ask your host to add the redirect for you.

Before making any changes, we recommend creating a complete WordPress backup so you can quickly restore your site if something goes wrong.

Next, connect to your website using an FTP client or your hosting provider’s File Manager. Then, navigate to your site’s root folder (usually public_html) and locate the .htaccess file.

Open the .htaccess file using the File Manager

Note: If you don’t see the .htaccess file, make sure your FTP client or File Manager is set to show hidden files, since files that begin with a period are hidden by default.

Open the file in a text editor and add the following line above the #BEGIN WordPress line:

Redirect 301 /old-page/ https://example.com/new-page/

Replace /old-page/ with the path of the old page and https://example.com/new-page/ with the full URL of the new page.

Create a redirect using the .htaccess file

Save the file and upload it back to your website if you’re using FTP. If you’re editing the file in your hosting account’s File Manager, then simply click the ‘Save Changes’ button.

Finally, visit the old URL in your browser to make sure it automatically redirects to the new page.

How to Redirect a WordPress Page After Changing Its Permalink

If you change a post’s permalink, then you should redirect the old URL to the new one. This prevents visitors from landing on a 404 error page and helps search engines find the updated URL.

When you change a post’s slug, WordPress remembers the old one and redirects it to the new URL automatically. It does not do this for pages, so a renamed page’s old URL returns a 404 until you create the redirect yourself.

With the 404 to 301 plugin, you can automatically create these redirects whenever you change a post or page slug.

Go to 404 to 301 » Settings and enable ‘Monitor post slug changes’ in the ‘General’ tab. Then, click the ‘Save Changes’ button to store your settings.

Enable Monitor Post Slug Changes option in 404 to 301 plugin

From now on, the plugin will automatically create a redirect whenever you rename a post or page slug.

For more details, see our guide on how to redirect a page or URL in WordPress.

How to Redirect a Deleted Page in WordPress

If you delete a page, then it’s a good idea to decide what should happen when someone visits its old URL. Use a 301 redirect if you’ve replaced the page with newer content, or a 410 Gone response if the page isn’t worth keeping, like a thank-you page, for example.

To return a 410 Gone response, follow the same steps as above to create a redirect. This time, choose ‘No Redirect’ as the ‘Target Type’ and ‘410 – Gone’ as the ‘Redirect Status’ before clicking ‘Create Redirect’.

Select 410 as the the redirect status in the 404 to 301 plugin

How to Redirect Multiple URLs to One Page in WordPress

Sometimes you need to send several old URLs to the same new page. For example, you might merge a few outdated tiny travel guides into one comprehensive travel guide.

Instead of creating a separate redirect for each URL, you can match multiple URLs with a single redirect rule.

Follow the same steps above to create a redirect, but this time, choose ‘Prefix’ or ‘Regex’ as the ‘Match Type’ when you enter the ‘Source URL or pattern’.

Choose Prefix as the match type in the 404 to 301 plugin

For example, choose ‘Prefix’ if you want to redirect every URL that starts with /travel/japan/, such as /travel/japan/tokyo-guide, to your new Japan travel guide. Choose ‘Regex’ only if you need to match more complex URL patterns.

Then, complete the remaining fields using the steps we described earlier and create your redirect.

If you have a large number of redirects to create, then you don’t have to add them one by one. The free Redirects Importer add-on lets you import redirects from a CSV file, which makes it much faster to add multiple redirects at once.

How to Redirect an Entire WordPress Website to a New Domain

If you’re moving your WordPress website to a new domain, then you’ll need to set up a full site redirect.

This automatically sends visitors and search engines from your old domain to the matching pages on your new domain, which helps preserve your traffic and SEO.

An example of moving an entire website to a new domain

Before setting up the redirect, make sure your website has already been moved to the new domain and is working correctly. See our guide on how to properly move WordPress to a new domain without losing SEO.

If you’re using a plugin that doesn’t support this feature, then you can redirect your entire domain at the server level using the .htaccess file or your web host’s redirect tools.

If you’re already using All in One SEO Pro, then you can create a full site redirect directly from your WordPress dashboard instead.

Simply go to All in One SEO » Redirects » Full Site Redirect, enable the ‘Relocate Site’ option, enter your new domain, and save your changes.

Set up a full site redirect in All in One SEO Pro

If you plan to cancel your old hosting account, then you’ll need to set up the redirect at the server or hosting level instead. Otherwise, visitors to your old domain won’t be redirected because WordPress will no longer be running.

For full details, see our guide on how to redirect an entire WordPress website.

A 404 error appears when someone tries to visit a page on your website that no longer exists. This can happen after you change a URL, delete a page, or when another website links to an outdated URL.

If you’re using the 404 to 301 plugin, then go to 404 to 301 » 404 Logs to see a list of broken URLs that visitors have tried to access on your website.

404 logging is enabled by default, but you can review or change these settings anytime under 404 to 301 » Settings » Logs.

View the 404 error log in the 404 to 301 plugin

The log shows the broken URL, it’s referring page, how many times the error occurred, its current status, and when it was last seen. This makes it easy to identify the most important broken links to fix first.

If you find a URL that should point to another page, then click ‘Actions’ next to it and choose ‘Custom redirect’.

Add a custom redirect for a 404 error in the 404 to 301 plugin

The plugin automatically fills in the ‘Source URL or pattern’ field. Complete the remaining fields using the same steps described earlier, then create your redirect.

You can also check the Page indexing » Not found (404) report in Google Search Console to see broken URLs that Google has discovered while crawling your website.

View 404 not found errors in Google Search Console

Frequently Asked Questions About WordPress Redirects

301 vs. 302 redirects: what’s the difference?

A 301 redirect tells browsers and search engines that a page has moved permanently. A 302 redirect indicates the move is temporary and the original URL will be used again. In most cases, you should use a 301 when permanently changing a page’s URL.

What’s the difference between a 301 redirect and a canonical tag?

Both help search engines understand your content, but they do different jobs. Use a 301 redirect when a page has permanently moved and you want visitors and search engines sent to the new URL.

Use a canonical tag when several pages have the same or similar content that should all stay accessible, but you want search engines to treat one as the primary version.

What causes a redirect loop in WordPress?

A redirect loop happens when a URL redirects back to itself, either directly or through another redirect. This prevents the page from loading because the browser gets stuck following redirects. Reviewing your redirect rules usually helps identify and fix the problem.

Should you redirect all 404 pages to your homepage?

No. Redirecting every 404 page to your homepage can confuse visitors because the content they expected isn’t there. Google may also treat these homepage redirects as soft 404s, meaning it recognizes that the original content is still missing.

Instead, redirect each broken URL to the most relevant page on your website. If there isn’t a suitable replacement, then it’s usually better to leave the page as a 404 or return a 410 Gone response if the content has been permanently removed.

If you’d rather keep visitors on your site, then you can also design a helpful custom 404 page that guides them to your popular content instead of a dead end.

Can I redirect a WordPress page to another website?

Yes. When creating a redirect, simply enter the external URL as the destination instead of another page on your website. This is useful if you’ve moved content to a different domain or want visitors to reach a resource hosted elsewhere.

We hope this beginner’s guide helped you set up redirects on your site. You may also want to see our pick of the best WordPress redirect plugins, and our WordPress SEO checklist to improve your search engine rankings.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

162 CommentsLeave a Reply

  1. Hi, thanks for the helpful article above.
    I have switched the permalink format from plain to post, and used the AISEO Pro Redirect function to redirect to the new page URLs. That all seems to be working fine – but now I can’t edit the pages. The system seems to be looking for the original plain format page address to edit. Help!
    Thanks in advance for your advice. Nick

    • The WordPress editor uses the Post ID so changing the permalinks should not affect the editor. Please be sure to clear any caching and if you’re on a localhost installation, ensure you have mod_rewrite enabled in the tool you are using.

      Admin

      • As long as proper redirects are in place, you could choose to delete the page if you are certain you no longer need it.

        However, sometimes it can be a good idea to turn it into a draft in case you need to reference it later.

  2. So I am just trying to understand. We have a wordpress website oldname.com. We rebranded the company and would love to use newname.com, but don’t want to lose any hyperlinks floating out in the world. Can I use the 301 redirect for the whole website on this website? Am I making sense? Help!!!

  3. What if you want to redirect a few specific blog posts to a new domain? For example: example.com/blog/hello-world to newsite.com/blog/hello-word. BUT, you don’t need to redirect ALL the old blog content. Just a few specific URLs?

    • If you wanted it to go to a completely new URL, you would want to place the full URL in the target URL field.

      Admin

  4. If I remove comments from my blog, do I need a redirect for the material that was removed. Not the post, just the comments.

  5. Hi, I have a post that I want to delete however after deleting it I plan on redirecting it to a page. Is this okay?

  6. I actually don’t have any problems while doing redirects, however, I have more than 50 redirects and plan to do more. Does this cause a problem as I also need to delete categories and some posts?

  7. i have made redirection with plugin “Redirection”then i deleted the redirection item from Redirection’s setting ,but i want to get it back the same what should i do

    • The simplest method would be to recreate the redirect rather than attempting to restore it.

      Admin

  8. I have transfer my site from a domain to a brand new domain. how can I do the 301 redirect without entering address by address?
    I mean I want to define something like this : all URLs of example.com goes to example.net for example.
    thank you so much in advance.

  9. I have the redirects set up and working great, but I have a question about finding and replacing all these redirected urls.

    Is there a way to find/replace them across your complete Wordpress site? Not just within the Wordpress database, but also within personal HTML code, and urls within tables using TablePress added to the website.

    I’m looking for a global find/replace solution, is there one?

  10. Is there any chance I can implement 301 in free WordPress.com? It says I’m not allowed to install plugins. Only if I’m on business plan. And I want to migrate to WordPress.org

  11. Hi,

    I have done a redirect some time ago using ‘Redirection’ plugin.

    But now I cant find that url in the plugin. Even there is no code for that url in htaccess file too.

    I want to disable that redirect now. Is there any way to do this? Pls help?

    • If the redirect is not in the plugin, you would want to check your htaccess file or reach out to your hosting provider for their assistance with finding the redirect.

      Admin

  12. If I’m redirecting several web pages (not posts), do I make duplicates of the code you showed above (both lines 1 and 2) for each of the new page I am redirecting? And do I keep copying those codes at the bottom of the .htaccess file?

    I read another article that suggests adding redirection codes in the functions.php file in the theme folder. The code is long and seems complicated. But I wonder, which option is more efficient — editing the .htaccess or editing the functions.php?

    • You would add a new version of the second line of code, you only need the first line once. For where the redirect happens it is personal preference on which method is best.

      Admin

  13. Hi

    Apparently my site has a 301 redirect on it, but I cannot discover where this is, nor what it is redirecting. There is nothing in the htaccess file. The site was originally built using a different name on localhost, and all the urls were changed to become the new domain name. Could this be the problem? How do I track down where the 301 is because it is causing problems with the SSL certificate. Thanks

    • Updating the urls shouldn’t be an issue if they were updated correctly. If you reach out to your hosting provider they should be able to help you find what is causing the redirect.

      Admin

  14. I can’t thank you enough for this simple guide as I’ve always been told to not touch redirects unless you know what you’re doing, so my seo suffered a bit because I ended up not doing anything. Fact is, I know enough and can follow instructions if they’re not written for developers and I don’t have to rely on a plugin that may cause problems later ’cause they all do at some point, right? Thank you. This link is going in my toolbox to share with others having the same problem.

  15. I used the method in the video, but my site still has Uncategorized listed at the top and the side. I tried to find the third part of the video about changing the 301 redirect links in my settings, but it is not there. However, when I click on Uncategorized it changes to general, but when I visit my site again or refresh it is back to Uncategorized. The plugin for redirects said it was compatible with my theme. Any help is appreciated, thank you.

  16. Hey there! thank you for the helpful info! I am wondering does this plugin work for a change of domain on my blog? I recently changed my domain and read that it is very important to implement a 301 redirect in order to not lose rankings and exposure. Would this do the trick? If so, would I put my old domain in the source line and the new domain in the target line?

    Thank you!

  17. Can I use “page links to” and “redirection” one the same site?

    They seem like they serve different needs, but I have seen warnings that you shouldn’t use more than one redirection plugin at a time. True?

    I like redirection features, but I like having something on the “edit post” view that I can use to set up a redirect (e.g., teaser/excerpt linking out to a landing page or to another site). Thanks!

    • We would not recommend using the two plugins at the same time to prevent any conflicts between the two, you could check with the plugin authors for if there is a recommended method for the two plugins to work together.

      Admin

  18. I migrated a WP website to a new domain and set up a redirect from the old domain to the new one within cPanel. The redirects are nearly instantaneous (that’s good, right?) but I’d like to delay them for a few seconds, long enough to display a screen on the old homepage explaining why they’re being redirected.

    I’m not a programmer. Is there a plugin that will allow me to adjust the time before the redirect occurs? TIA

    • Unless I hear otherwise, we do not have a simple method we would recommend to set that up sadly.

      Admin

  19. Hello,
    A great post by the way.
    I have numerous pages which have been redirected to new urls, I have updated all page link urls to the new urls, so no broken links on front end.
    My question is after a few months is it safe to delete any redirects which were created?
    Many thanks.
    Lee

    • If there are no references to the broken links you could remove the redirects, otherwise it may be best to keep the redirects active.

      Admin

  20. Hi, I have been using the redirection plugin for a while now trying to sort my old posts out from when I first started ( the permalinks were awful )
    What I have been doing is creating another post with a better permalink and copy and pasting the content from the old URL to the new one and then 301 redirecting them.
    After reading this post I’m starting to think that I don’t need to create a completely new post but just change the permalink on the old one and redirect it like that, Am I Correct?
    If so, can I delete all the old duplicate posts from before or should I leave them as they are?
    Thanks if you can help :)

    • Correct you can modify the permalink and redirect without the need for the old post to be active. As long as the redirects are in place you can remove the old posts if you wanted.

      Admin

      • So just to clarify, I can delete the old posts that I copied and pasted into a new one and redirected the URL, and that all I have to do is to modify the permalink and not copy and paste the whole URL into a different post but just redirect the old permalink to the new one?
        Thanks so much for replying to me, you have saved me so much time if that’s the case :)

  21. Hi, I recently duplicated a site. Let’s say the original site’s url is original.com and I created a subdomain http:testsite.orginal.com where the duplicate site is located. Now, the question is how do I do the redirection with this kind of setup. I want to make the site at original.com to be the main site.

    Thanks

  22. Hi – thank you for this! Love you guys. I downloaded the plugin and have redirected some pages. Can you tell me if I should redirect mysite.com to miresite.com/ – how do I do that? somewhere along the line the “/” fell away. There were 4 different redirect plugins on the WP site I am working on for a client and the site crashed last week – I deactivated them all and installed this one – all is good except for the/ thing. Am I even asking a logical question?

    • You shouldn’t need to worry about redirecting the site to an address with a / at the end

      Admin

      • Hi – I have now discovered that my page mydomian.com/ is being redirected to mydomain.com – without the /

        I don’t know where this happened or how except from possibly one of the plugins I downloaded?? It is a 301 and I do not know now if this has damaged anything? All the search results show the address with the /. but when the result is clicked it go to the non /. please can you help or send me to somewhere that can help of fix

        • You would first want to take a look at your plugins if any of them are designed for redirects you would want to see if that is set there. If none of those are causing the redirect you would want to see if the redirect is created in your htaccess file or under Settings>General if the address was changed there.

  23. does this work the same for 302 redirects in an htaccess file? A client has asked to 302 redirect around 800 urls from a wordpress site to a Wix site. There are moments when it all operates fine, then we get several 404’s. Not sure if it’s because there are way too many urls or if we are overlooking something?

    • The htaccess method would work for 302 redirects if you changed the number to 302. 302 redirects are temporary which could be part of your problem as well as your caching.

      Admin

  24. I have a WordPress site. I face some problem. I am using the woo commerce plugin. Woocommerce site automatically added product category page in my permalinks as- google.com/product-category/up/this-is-my-page. I want to redirect this link like- google.com/this-is-my-page. how can i solve this? any help

    • For editing WooCommerce’s permalinks, you would want to check under Settings>Permalinks to modify them. If you take a look at WooCommerce’s documentation they explain more in depth. :)

      Admin

  25. Hi, Wp beginnger, if you could help me i will be do happy, I used the Htacces code and it worked perfectly. But i want My Media Files to redirect to itself,
    So is there a code to stop The d=redirection in Wp-contents Folder..pls help me my Website is Dieing

  26. Hello, does this redirection works for a URL complete change?

    For example, I’m using olddomain.com and I bought newdomain.com, and want to redirect olddomain.com to open up newdomain.com.

    Any help on that??

  27. How can I redirect a single homepage to another domain but the rest of the pages from my redirected domain won’t be affected?/

  28. I have a subdomain for affiliate store. I want to know how to redirect from my site page to subdomain page. Please help.

  29. Thank You so so much! I have been blogging for about 8 months and have worked so hard to build my Pinterest account. It is where almost all my traffic comes from. A month ago I changed over to https and I didn’t realize until last night that none of my pins were redirecting to the https. I just fixed it all thanks to you!

  30. thanks for the information. i have small doubt how can i redirect old post to new post without loss of comments. i mean i need previous comments

  31. Just FYI – the screenshots are out of date I think. Under Add New Redirection, I just see Source/Target URL and Group.

  32. Hi, I am trying to find a way to redirect to a single page similar to a 404 when a user enters a non-existent subdomain. for example if they mash the keyboard or make a typo when keying in the domain. I want to get rid of the standard wordpress ‘No Results Found…The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.’

    Can someone point me to the solution of this problem? Or what this is called so I can try find the solution? All I’m getting is results about making my multisite a single url…

    Thank you!

  33. I only want to redirect when a visitor to my website clicks on an external link from my website. For example, if you were to click on a product from my page it would then redirect you first to a “You are being redirected” page, then off to the affiliate’s website.
    I have been spending hours trying to do this. Please help. At this point I just want to know if it is possible with any wp plugin or any other workaround and if so how to do it.

  34. How do I redirect from a wordpress blog (free) to a .com blog? I cannot install plugins in the free blog, so how could I do the redirect? Any advice?
    Thanks in advance

  35. Hello! I just created a website on Wordpress.org and imported all of my content from my old site, example.wordpress.com (using Wordpress.com). Is there a way to redirect all of the content from that site to my new one? The redirect instructions provided by Wordpress gave me an error that the domain already exists, probably because it thought I was trying to create a new domain on Wordpress.com.

    My website traffic before is pretty minimal, so if anyone clicks on previous blog posts on my social channels, they’d be taken to the shut down version of my old site without the redirects – not the end of the world because I don’t have the following that would generate clicks at a later date, but you never know?

    Any advice anyone has would be great!

    Thanks,

    Hannah

  36. Brilliant solution to reduce redirects for worpress!

    For a few days, I’m looking to solve my WP redirects issues. I don’t find out better solution even read this content.

    Here, I got few good points and try to reduce redirect to increase my page load speed.

    Thanks! :)

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.