Mod_rewrite 301 redirects surge memory in destiny server

August 2, 2015 433 views
Apache Nginx


I'm facing a problem and i can't figured out a solution.

I have an old website and domain in another server and i want to redirect all the pages to the new website and domain in DigitalOcean server.

To accomplish this i remove the old website and stablish the mod_rewrite redirects into htaccess.

The problem is, when i setup the redirects the memory and cpu of the destiny server (DigitalOcean new server) surge completely.

I have 3k URL redirects in the htaccess, here's what i have in the file:

Options +FollowSymLinks
RewriteEngine on

URL Redirect example
RewriteRule ^old-site-url/ [L,R=301,NC]

I really need some help.

Thanks in advance

2 Answers


It sounds like the very large amount of rewrite rules is causing this. If only the domain name has changed and the url structure is still the same, you can use the following rules instead to redirect to the new domain name:

RewriteCond %{HTTP_HOST} ^ [NC,OR]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

Hi kamaln7,

Was a plugin conflict, i came up with a fix.

Anyway i made all the 3k redirects but not in .htaccess, instead i used Apache dbm in Vhost.

Thanks for your help anyway :)


Have another answer? Share your knowledge.