
Lately, I wrote about how my website was being attacked and the way I lastly migrated to Cloudflare to finish the barrage of bot visitors. The bot visitors was additionally destroying efficiency on my website as a result of it was hitting what seemed to be an infinite variety of nonexistent URL paths, driving up queries of wildcard redirects that had been by no means going to work.
Desk of Contents
How WordPress Redirects Influence Efficiency
Whereas troubleshooting reminiscence and CPU utilization and resolving the problems, I used to be nonetheless stunned by the sources static redirects had been consuming. Then I began analyzing the method wanted for a URL that doesn’t exist to be processed by my server:
- Incoming HTTP request: The online server receives a request for a URL and performs its most simple checks, together with SSL negotiation, digital host matching, and static file existence. If the requested file exists bodily on disk, corresponding to a picture, CSS file, or static HTML file, it’s served instantly with out invoking WordPress.
- Internet server–stage rewrite guidelines: If no static file exists, the server evaluates rewrite and redirect guidelines outlined on the server layer, corresponding to Nginx rewrite directives or Apache mod_rewrite guidelines in .htaccess. Redirects dealt with listed here are accomplished earlier than PHP or WordPress is loaded, making them the least resource-intensive possibility.
- PHP bootstrap and WordPress load: If no server-level rule resolves the request, the server routes the request to
index.php, triggering PHP execution and the WordPress bootstrap course of. At this level, core WordPress recordsdata are loaded, plugins are initialized, and reminiscence and CPU utilization enhance meaningfully. - Parsed request and question decision: WordPress parses the requested URL to find out whether or not it maps to an present publish, web page, customized publish kind, taxonomy, or different registered rewrite endpoint. This course of entails a number of database queries in opposition to the posts, phrases, and choices tables.
- Redirect lookup through plugins or core hooks: If the requested URL doesn’t resolve to legitimate content material, WordPress checks registered redirect logic. This will likely embody core canonical redirects, customized redirect code, or redirect plugins that question their very own database tables or cached guidelines to discover a matching supply URL.
- Redirect cache analysis: Nicely-implemented redirect methods test in-memory caches or object caches first, then fall again to database lookups provided that wanted. Poorly optimized redirect plugins might execute a number of database queries on each miss, compounding server load on high-traffic websites.
- Redirect response issued: If an identical redirect is discovered, WordPress sends the suitable HTTP standing code, corresponding to 301 or 302, and halts additional processing. The request ends right here, however solely after WordPress and PHP sources have already been consumed.
- 404 dedication: If no redirect rule matches, WordPress marks the request as a 404 and prepares the error response. This nonetheless requires full WordPress execution, together with theme loading and template decision.
- 404 template rendering: The energetic theme’s 404.php template is loaded, together with any related property, hooks, widgets, or monitoring scripts. Regardless that the web page shows not discovered content material, it’s typically one of the crucial resource-intensive outcomes as a consequence of full-page rendering.
- Response supply: The ultimate HTML response is distributed again to the browser, finishing the request lifecycle. From the server’s perspective, this path represents the utmost price state of affairs for a single unresolved URL.
For any website that’s been migrated, permalinks restructured, or is solely an previous website… redirects are vital for the person expertise and for sustaining backlink authority to related pages for search engine optimisation. When redirects are dealt with inside WordPress, the server is compelled to do way more work than most website house owners notice. Every unresolved URL requires PHP to start out, WordPress core to load, plugins to initialize, and a number of database queries to run earlier than a redirect determination is even made.

On a busy website, this implies CPU cycles, reminiscence, and database connections are being consumed to inform the browser to go someplace else. Multiply that price throughout 1000’s of legacy URLs, mistyped hyperlinks, bot visitors, and exterior backlinks, and redirects quietly grow to be a measurable efficiency and stability legal responsibility.
To place it into perspective, Martech Zone is nearing 20 years with a number of domains, migrations, and permalink construction adjustments, in addition to 1000’s of affiliate hyperlinks that I make the most of redirects for. I’ve amassed over 6,100 redirects! In consequence, the majority of my server sources had been spent on redirects slightly than presenting precise content material.
Why To Migrate Redirects Off WordPress and Onto Your Server
Transferring redirects to the server layer eliminates almost all of that overhead. When Nginx or Apache processes a redirect, the choice occurs earlier than PHP is invoked and earlier than WordPress ever masses. There aren’t any database queries, no plugin execution, and no theme rendering. The server evaluates a easy rule, returns a 301 or 302 response, and closes the request.
This reduces time-to-first-byte (TTFB), lowers PHP and database load, and preserves WordPress sources for requests that truly want dynamic content material. In sensible phrases, server-level redirects scale higher, reply quicker, and scale back the blast radius of visitors spikes, crawlers, bots, and damaged hyperlinks. For any website involved with efficiency, reliability, or price effectivity, redirects belong as near the net server as doable, not buried inside the appliance layer.

1 In consequence, Cloudflare was the proper resolution for migrating my redirects. Now, the redirects plugin doesn’t use any sources to question and cache redirects inside WordPress… Cloudflare handles all of it.
How To Migrate Redirects to Cloudflare
As a result of I’d migrated my CDN to Cloudflare to treatment the bot assault, I researched and located that they’d a sturdy redirect engine that allowed bulk uploads of redirects. The method for migrating backlinks wasn’t simple, so I need to doc it right here in case you’re trying to do it as nicely:
- Exported my static (not wildcard or regex) redirects from Rank Math right into a CSV file.
- Imported the CSV to Guidelines > Redirect Guidelines > Go to Bulk Redirects.

- The import for Cloudflare Bulk Redirects has some particular necessities. Sadly, the documentation isn’t that nice, and the error messaging is worse… so right here’s what I discovered:
- The ultimate CSV has simply two columns, with no header row: supply and vacation spot URLs. I eliminated all further columns and the header row.
- A whole supply URL, so I needed to write a system to concatenate
https://martech.zoneearlier than the supply path. - Redirection plugins enable duplicates (sadly), which should be faraway from the CSV, or the redirect import will fail.
- I didn’t all the time have trailing slashes, so I added them to the supply URL the place vital as nicely. This implies I keep away from having two information per redirect, and I’ll add a rule for a trailing slash arising.

- Added a rule for Cloudflare to all the time append a trailing slash to my URLs the place applicable.

- Added a Bulk Redirect Rule to allow the redirects.

- Examined a number of redirects to make sure they labored.
- Backed up my website and database.
- Disabled redirections on my website and dropped the redirection and redirection cache tables, as they’re not vital.
- Monitored efficiency.
- Finally, I downgraded my Linode occasion to a server with half the house and CPU sources… reducing my internet hosting invoice in half. And I’ll even have the ability to do it once more after I observe efficiency for some time.

©2025 DK New Media, LLC, All rights reserved | Disclosure
Initially Printed on Martech Zone: Why and How I Migrated Redirects off WordPress to Cloudflare
