A page moves, a slug changes, or a whole site migrates to a new domain — and suddenly every old link is a 404. Redirects fix that instantly, but most tutorials only show you the plugin route, which adds another dependency to a site that's already carrying too many.
You don't need a plugin for most redirects. WordPress and your server already have everything required — you just need the right code in the right file. Below is exactly how to do it, when a plugin genuinely earns its place, and how to avoid the chains and loops that quietly wreck SEO.
How do you create a 301 redirect in WordPress without a plugin?
There are two native ways to redirect a URL in WordPress without installing anything:
Edit your .htaccess file (Apache servers) — fastest, happens before WordPress even loads.
Add a snippet to functions.php — useful when you want redirect logic tied to conditions WordPress understands (user role, post type, query variables).
Both produce a real, crawlable 301 response. Neither requires plugin overhead. Pick .htaccess for simple one-to-one URL swaps; pick functions.php when the redirect depends on WordPress logic rather than just the URL string.
How do you redirect via .htaccess?
Your .htaccess file sits in your site's root directory, right next to wp-config.php. Back it up before editing — one typo here can take the whole site down.
For a single page:
Redirect 301 /old-page/ https://example.com/new-page/
For an entire folder or category moving to a new path, use RedirectMatch with a pattern instead of listing every URL:
RedirectMatch 301 ^/old-category/(.*)$ /new-category/$1
For more control — wildcards, query strings, conditional logic — use mod_rewrite:
RewriteEngine On
RewriteRule ^blog/tag/(.*)$ /blog/category/$1 [R=301,L]
Placement matters. WordPress writes its own rewrite block into .htaccess, bookended by # BEGIN WordPress and # END WordPress. Your custom redirects should sit above that block, so they're evaluated before WordPress's own routing takes over:
`# Custom redirects — added manually
Redirect 301 /old-page/ https://example.com/new-page/
BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
END WordPress`
Editing .htaccess to add a 301 redirect above the WordPress rewrite block
How do you create a redirect using functions.php?
When the redirect needs to check something WordPress-specific — a query variable, a logged-in user, a custom post type — .htaccess isn't the right tool. Hook into template_redirect instead:
`
function whla_custom_redirects() {
$redirect_map = [
'old-page' => '/new-page/',
'old-service' => '/services/new-service/',
];
$request_path = trim( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), '/' );
if ( isset( $redirect_map[ $request_path ] ) ) {
wp_safe_redirect( home_url( $redirect_map[ $request_path ] ), 301 );
exit;
}
}
add_action( 'template_redirect', 'whla_custom_redirects' );
`
A few details that matter here:
Always pass the status code explicitly ( 301) to wp_safe_redirect() — WordPress defaults to 302 if you omit it, which is the single most common cause of a redirect not passing SEO value the way you expect.
Always call exit; after the redirect, or WordPress will keep rendering the original page alongside the redirect header.
This approach is fine for a handful of redirects. Once you're past 15–20 entries, a flat PHP array becomes hard to maintain — that's the point where a plugin or .htaccess rules make more sense.
What about Nginx?
If your host runs Nginx instead of Apache, .htaccess does nothing — Nginx redirects live in the server block, and changes require a config reload (something your host or dev handles, since most managed WordPress Nginx setups don't give shell access).
`location = /old-page/ {
return 301 /new-page/;
}
location ~* ^/old-category/(.*)$ {
return 301 /new-category/$1;
}`
Nginx redirects execute earlier in the request cycle than either of the WordPress-side methods, which makes them the fastest option — but also the one requiring server access most site owners don't have day to day.
301 vs 302 vs 307/308 — which one when?
Picking the wrong status code is the most common redirect mistake we see on client sites. Each one tells search engines and browsers something different:
Code Meaning What it signals Use it when
301
Permanent
Transfers link equity to the new URL; browsers and search engines cache it long-term
The old URL is gone for good — renamed page, merged content, domain migration
302
Temporary
Search engines generally keep indexing the original URL
A short-term test, maintenance mode, or A/B variant
307
Temporary, method-preserving
Same as 302, but guarantees the request method (GET/POST) isn't changed
Temporary redirects involving form submissions
308
Permanent, method-preserving
Same as 301, but guarantees the request method isn't changed
Permanent redirects where the original request was a POST
For nearly all WordPress redirect scenarios — moved pages, changed slugs, site migrations — 301 is the right default. Reach for 302/307 only when the change is genuinely temporary.
How do you redirect with a plugin?
Manual redirects work well for a handful of URLs. Beyond that, a dedicated plugin like Redirection (free) or Yoast SEO Premium's redirect manager earns its keep.
Green flags for using a plugin:
You're managing 20+ redirects and need a searchable interface, not a growing PHP array
You need automatic 404 logging to catch broken links you didn't know existed
Non-developers on your team need to add redirects without touching code
You're migrating dozens or hundreds of URLs and want CSV bulk import
Red flags — skip the plugin:
You have fewer than a dozen redirects total (a few lines of .htaccess is faster and adds zero overhead)
The site is already plugin-heavy and performance-sensitive
The redirect is permanent infrastructure, not something that needs a UI to manage
Both Redirection and Yoast Premium support regex patterns and CSV import, which makes them the practical choice for large-scale migrations rather than hand-writing hundreds of RedirectMatch rules.
Comparing manual .htaccess redirects versus a WordPress redirect plugin dashboard
How do you redirect after changing a slug or migrating your site?
A single slug change is simple — WordPress will offer to create the redirect for you if you use the built-in URL change prompt, but it's not guaranteed to catch every case, so verify it manually with the .htaccess or plugin methods above.
A full website migration or restructure is a different scale of problem. Before you touch DNS or go live on a new domain:
Export a full URL list from your old site (Screaming Frog or your XML sitemap both work).
Build a mapping table — old URL → new URL — for every page, post, and category that's changing.
Convert the mapping into redirect rules — bulk-imported into a plugin, or generated as RedirectMatch patterns if the URL structure changed predictably (e.g., /old-category/ becomes /new-category/).
Test every rule before launch, not after — see the testing section below.
Update internal links in your content to point directly at the new URLs rather than relying on the redirect chain to carry the traffic.
This is exactly the kind of detail work that's easy to under-scope on a DIY migration. If you'd rather hand this off, our WordPress website migration service handles the full URL mapping and redirect setup as part of the move.
How do you test redirects and avoid chains or loops?
Never assume a redirect works because it "looks right" in the code — verify it with curl:
curl -I https://example.com/old-page/
A working 301 returns something like this:
HTTP/2 301
location: https://example.com/new-page/
If you see a 200 where you expected a 301, the rule isn't matching. If you see more than one Location: header across repeated requests, you've likely created a redirect chain — Old URL → Middle URL → Final URL — which slows the browser down and dilutes the SEO value passed along. Fix it by pointing every step directly at the final destination.
A redirect loop (A → B → A) is worse — the browser will eventually give up and show an error. These usually happen when a plugin rule and a manual .htaccess rule conflict, or when www and non- www versions of a rule redirect into each other. Always test the full chain after any migration or bulk redirect import, not just a sample.
Testing a WordPress 301 redirect with curl -I in the terminal
How does redirecting affect SEO, and how long should you keep 301s?
A correctly implemented 301 passes the substantial majority of the original page's ranking signals to the new URL — Google has said as much for years, and in practice sites we've migrated retain their rankings within days to a few weeks once the new URLs are crawled and indexed.
Keep 301s in place indefinitely. Removing them once traffic to the old URL "looks quiet" is a common mistake — old backlinks, bookmarks, and cached search results can send visitors to that URL for years. If you're doing a broader overhaul rather than a single redirect, our website redesign SEO checklist covers the rest of what needs to survive a redesign intact — redirects included.
Frequently Asked Questions
How do I do a 301 redirect in WordPress without a plugin?
Add a Redirect 301 or RewriteRule line to your site's .htaccess file (Apache), or hook a redirect into template_redirect in functions.php using wp_safe_redirect() with a 301 status code. Both methods work without installing anything.
How do you create a redirect URL in WordPress?
Decide on the old path and the new destination, then add a matching rule in .htaccess ( Redirect 301 /old-path/ /new-path/), in functions.php, in your Nginx config, or through a redirect plugin — the method depends on your server and how many redirects you need to manage.
How do you redirect a page using .htaccess in WordPress?
Open .htaccess in your site's root folder, add a Redirect 301 or RewriteRule line above the # BEGIN WordPress block, and save. Test immediately with curl -I to confirm the response is a 301 pointing at the correct new URL.
What's the difference between a 301 and a 302 redirect?
A 301 tells browsers and search engines the move is permanent and transfers the original page's SEO value to the new URL. A 302 signals a temporary change, and search engines typically keep the original URL indexed rather than replacing it.
Do I need a plugin to redirect URLs in WordPress?
No. .htaccess, Nginx config, and functions.php can all handle redirects natively. A plugin like Redirection or Yoast Premium becomes worth installing once you're managing dozens of redirects, need 404 logging, or want a non-developer to manage them through a dashboard.
Redirects are a small piece of code with an outsized effect on lost traffic and lost rankings — get the status code and the placement right, and they quietly do their job for years. If you're planning a larger migration, restructure, or need ongoing WordPress development handled by a team that treats details like this as standard practice, our custom WordPress development team can take it from here.
Originally published on the Web Help Agency blog.


Top comments (0)