What’s the best way to manage 1,000+ Apache 301 redirects?

September 22, 2026 4 answers
Asked by 0.6 of a clue
My website has been running for more than 15 years, and over time I've removed, renamed, and reorganized many pages. I now have more than 1,000 permanent redirects. The site is mostly static PHP and HTML hosted on Linux with Apache. What is the most efficient way to maintain this redirect list without unnecessarily affecting server performance or Core Web Vitals?

Answers

sieve.logic
For a list this large, use Apache’s RewriteMap in the virtual host configuration rather than putting hundreds of rules in .htaccess. Store the redirects in a text map with one old path and destination per line, then have Apache perform a lookup. Make sure unmatched URLs are allowed to return a normal 404—don’t use a fallback that redirects every unknown path to the homepage. Generate the map from a maintained source file if possible, and collapse old redirect chains so each URL points directly to its final destination. After updating the map, reload Apache gracefully and test the old URLs for loops, typos, and unexpected chains. Redirect responses themselves aren’t measured as page-rendering Core Web Vitals because the old page never loads.
Reply to this answer
Gullwing
Put the rules in the main Apache virtual host configuration instead of .htaccess. Apache has to check .htaccess files during request processing, while the vhost configuration avoids that directory-level overhead. If several redirects follow the same pattern, combine them into a few RewriteRule patterns rather than maintaining 1,000 individual entries.
Reply to this answer
_meter running
Before keeping every redirect forever, inspect the access logs and analytics. Some old URLs may only be requested by crawlers and have had no real visitors for years. Those can often be removed and allowed to return 404, which keeps the redirect list smaller and easier to maintain. Be careful not to redirect unknown URLs broadly, since that can create misleading duplicate pages or send unrelated requests to the wrong destination.
Reply to this answer
ROLLER_derby
A thousand redirects is not usually a meaningful performance problem by itself, especially when Apache is doing a direct lookup. The bigger risks are redirect chains, duplicate rules, and accidental catch-all redirects. Keep the list in one source of truth, point each old URL straight to its final destination, and periodically verify the full list automatically.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions