Beginners Guide to Creating Redirects in WordPress
Broken links and changed URLs are inevitable when managing a site over time. Without a proper system in place, visitors land on 404 errors, search engines...
Broken links and changed URLs are inevitable when managing a site over time. Without a proper system in place, visitors land on 404 errors, search engines lose your content, and you risk wasting hard-earned rankings. That’s where WordPress redirects come in. With a few simple techniques, you can route visitors and bots from old URLs to the new, correct destination.
What a Redirect Is (and Why It Matters)
A redirect is a rule that automatically sends a browser or search engine from one URL to another. When a visitor hits an outdated or removed address, the server responds with a specific HTTP status code and a new location.
Common reasons you might need redirects include:
- Renaming or restructuring your permalink URLs
- Migrating content from one domain or subdomain to another
- Fixing broken internal links and 404 errors
- Consolidating thin content into stronger, updated articles
- Enforcing a single preferred domain (with or without www) or protocol (HTTP to HTTPS)
Handled correctly, redirects protect user experience and help preserve existing search visibility when your content moves.
Main Types of Redirects You’ll Use in WordPress
While there are many HTTP status codes, a few are especially important when working with WordPress.
301 Redirect (Moved Permanently)
A 301 redirect tells browsers and search engines that a URL has been permanently moved to a new location. This is the most common type for SEO-sensitive changes, such as:
- Changing slug structures (e.g.,
/blog/post-nameto/post-name) - Moving content to a new category or section
- Redirecting old posts to new, consolidated versions
- Switching from non-www to www or from HTTP to HTTPS
Search engines generally transfer most of the ranking signals from the old URL to the new one over time when a proper 301 is in place.
302 Redirect (Found / Temporary)
A 302 redirect indicates that the move is temporary. You might use it when:
- Running an A/B test between two URLs
- Temporarily redirecting a page during a campaign or promotion
- Redirecting to a maintenance or “coming soon” page
For long-term changes, stick with 301. For short-term or reversible changes, 302 is appropriate.
Other Useful Types
- 307 Temporary Redirect: Similar to 302 but preserves the HTTP method. Useful in some modern setups, but less common in simple WordPress configurations.
- 410 Gone: Explicitly tells search engines that a page has been permanently removed and should be dropped from the index. This is useful for content you never want to replace.
Planning Your Redirect Strategy
Before you start adding redirect rules, it’s worth clarifying what you’re trying to achieve. A bit of planning will help you avoid redirect chains and conflicts.
Identify Which URLs Need Attention
Good candidates for redirects include:
- URLs returning 404 errors that still have traffic or backlinks
- Outdated pages replaced by newer, more comprehensive versions
- Old landing pages replaced by a new campaign URL
- Legacy structures from previous CMS platforms
You can find these URLs using:
- Your analytics tool (top pages with 404 response)
- Search Console coverage and crawl error reports
- SEO auditing tools that detect broken internal links
Map Old URLs to the Best New Destination
Redirects should lead to the most relevant equivalent page, not just your homepage. Examples:
- Old product pages → New product detail or category pages
- Outdated blog posts → Updated guides or related topics
- Removed services → Closest current service or a clear explanation page
A thoughtful redirection map maintains user intent and relevance, which also helps search engines understand the continuity of your content.
Creating Redirects Using a WordPress Plugin
For most site owners, the simplest and safest approach is to manage redirects with a plugin. This avoids direct edits to server configuration files and offers a user-friendly interface.
Advantages of Using a Plugin
- No need to edit system files like
.htaccessornginx.conf - Centralized management of all redirect rules
- Logging and tracking of hits to redirected URLs
- Support for complex conditions (e.g., query parameters, device types)
Step-by-Step: Adding a Basic Redirect
The following steps outline the general process you’ll follow with most redirect management plugins:
- Install and activate a reputable redirect plugin from the WordPress plugin repository.
- Go to the plugin’s settings screen in your WordPress dashboard.
- Create a new redirect rule:
- Enter the source URL (the old, broken, or outdated URL).
- Specify the target URL (the new, correct destination).
- Choose the status code, typically 301 (permanent).
- Save the rule and test it in a private browser window to confirm it works.
Many plugins also allow bulk import via CSV, which is useful if you maintain a redirect map in a spreadsheet.
Example: Redirecting a Single Page
Imagine you changed an article URL from:
/2020/01/10/wordpress-redirects/
to:
/wordpress-redirect-guide/
You would add a new 301 redirect from the old slug to the new one. Any user (or bot) visiting the old link is automatically served the updated content.
Creating Redirects with .htaccess (Apache)
If your server uses Apache and you’re comfortable editing system files, you can create redirects directly in .htaccess. This approach is more technical but avoids plugin overhead and runs at the server level.
Before You Edit .htaccess
- Back up the existing
.htaccessfile via FTP or your hosting file manager. - Make small, incremental changes and test frequently.
- Be especially careful not to delete existing rules that WordPress or your host requires.
Simple 301 Redirect for a Single URL
Add this snippet near the top of your .htaccess file, above the default WordPress rules:
Redirect 301 /old-page/ https://example.com/new-page/
Key points:
- Use the relative path for the old URL (starting after the domain).
- Use the full absolute URL for the destination.
Redirect an Entire Folder to a New Path
If you’ve changed a directory structure, you can redirect all requests from one folder to another:
RedirectMatch 301 ^/old-section/(.*)$ https://example.com/new-section/$1
This pattern captures everything after /old-section/ and sends it to the same path under /new-section/.
Enforce HTTPS with Redirects
If your site uses an SSL certificate, you should ensure all traffic is forced to HTTPS. A common pattern in .htaccess looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
</IfModule>
Replace example.com with your domain. This forces all non-secure requests to the HTTPS version.
Creating Redirects with Nginx
If your hosting stack runs on Nginx, redirects are configured in the server block rather than in an .htaccess file. The change process depends on your host; some provide a user interface, while others require SSH access.
Simple 301 Redirect in Nginx
In an Nginx server block configuration, you might add:
location = /old-page/ {
return 301 https://example.com/new-page/;
}
After editing, reload the Nginx configuration:
sudo nginx -t
sudo systemctl reload nginx
Always run the configuration test command before reloading to avoid downtime due to syntax errors.
Redirect All HTTP to HTTPS in Nginx
A common pattern for forcing HTTPS is:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
This redirects every HTTP request to the secure version while preserving the original request path and query string.
Using the Native WordPress Toolkit for Redirect-Like Behavior
WordPress has some built-in behaviors that resemble simple redirects, especially for permalinks, but they’re not a replacement for a well-managed redirect strategy.
Permalink Changes
When you update a post slug, WordPress often attempts to handle requests to the old slug by internally resolving them to the new one. However:
- This behavior isn’t reliable in complex scenarios.
- It doesn’t give you control over status codes or log hits.
- It won’t cover URL changes outside the typical post or page structure.
For critical content and SEO-sensitive migrations, it’s best to create explicit redirects.
Custom 404 Page as a Safety Net
Even with robust redirect rules, some URLs will inevitably fail. A well-designed 404 template can help users recover:
- Explain that the page cannot be found.
- Offer a search bar.
- Link to popular categories or key landing pages.
- Include clear navigation back to your homepage.
This doesn’t replace redirects but reduces frustration when users land on URLs you can’t reasonably map.
Best Practices for SEO-Friendly Redirects
Not all redirects are equal from a search perspective. A few common mistakes can create crawl inefficiencies and dilute ranking signals.
Avoid Redirect Chains and Loops
A redirect chain occurs when one URL redirects to another, which redirects to another, and so on. For example:
/old-page/→/new-page/→/final-page/
This wastes crawl budget, slows down page load, and can cause bots to give up before reaching the final destination. Instead, redirect each old URL directly to the final target.
A redirect loop is even worse—when URL A redirects to B, and B sends the user back to A. Browsers will stop loading and show an error, and search engines can’t access the content. Always test new rules to prevent loops.
Use the Correct Status Codes
- Use 301 for long-term or permanent changes you don’t plan to reverse.
- Use 302 or 307 when you know the redirect is temporary and the original URL will return.
- Consider 410 for pages deliberately and permanently removed without replacement.
Using temporary codes for permanent moves can send mixed signals to search engines and delay the transfer of ranking signals.
Redirect to the Most Relevant Equivalent
Sending every outdated URL to the homepage or a generic page is a poor user experience and can be interpreted as soft 404s by search engines. Always:
- Match informational content to the most similar resource.
- Match product pages to the same product, its updated version, or at least its category.
- Explain removals clearly when no close equivalent exists.
Keep an Eye on Performance
Too many complex rules, especially at the application level, can affect response times:
- Group patterns into concise rule sets instead of hundreds of individual lines where possible.
- Prefer server-level rules for very large redirect lists.
- Periodically audit and clean up obsolete redirects that no longer receive traffic.
Testing and Monitoring Your Redirects
Setting a redirect is only half of the job. You also need to verify that it works as intended and continues to behave correctly over time.
How to Test Individual Redirects
Use these methods to check a single redirect:
- Open the old URL in a private browser window and confirm you land on the correct destination.
- Use browser developer tools (Network tab) to inspect the HTTP response status.
- Run the URL through an HTTP header checker to confirm the status code (301, 302, etc.).
Testing is especially important when you add pattern-based rules using regular expressions.
Monitor 404 Errors and Redirect Performance
Over time, your site will accumulate new broken links from external sources, typos, and legacy content. Keep on top of them by:
- Regularly checking server logs for 404 responses.
- Reviewing Search Console coverage reports for “Not found” pages that receive impressions.
- Using an SEO crawler to scan for internal links that lead to 404s or redirect chains.
- Using your redirect plugin’s logs (if available) to see which redirects get the most hits.
This feedback loop helps you refine and expand your redirection strategy as your site grows.
When to Use a Plugin vs. Server-Level Redirects
Both approaches have their place, and many sites benefit from a mix of the two.
Use a Plugin When:
- You manage a small to medium number of redirects.
- You want a simple interface for non-technical team members.
- You need conditional logic (e.g., based on login state, language, or referrer).
- You prefer not to edit server configuration files.
Use Server-Level Redirects When:
- You have a very large list of redirects that might affect performance if handled by PHP.
- You’re performing a domain-wide migration or enforcing HTTPS and canonical hostnames.
- You need to handle redirects before WordPress loads for technical or performance reasons.
In practice, you might put global rules (HTTP to HTTPS, www to non-www, domain-wide moves) at the server level and use a plugin for day-to-day content redirects.
Common Scenarios and Example Redirects
To make things more concrete, here are some typical situations and how you might handle them.
Restructuring Blog Categories
You decide to replace a category URL from /category/tutorials/ to /category/guides/. You’ll want to:
- Redirect the old category archive to the new category archive.
- Redirect individual posts if their slugs or paths changed as part of the restructure.
For an Apache setup, for example, you could use:
Redirect 301 /category/tutorials/ https://example.com/category/guides/
Migrating from a Subdirectory to the Root
If you move a WordPress installation from /blog/ to the root domain, you’ll likely want all old URLs under /blog/ to map to their equivalent at the root.
Example pattern in Apache:
RedirectMatch 301 ^/blog/(.*)$ https://example.com/$1
Always test several representative URLs to ensure the pattern behaves as expected.
Retiring a Product Line
When you permanently discontinue a product, you have a few options:
- If there’s a direct replacement, redirect to the new product page.
- If not, redirect to the closest related category or a page that clearly explains the discontinuation.
- If there is no relevant alternative and you don’t want to maintain that traffic, consider a 410 status instead of a redirect.