Mod_rewrite 301 redirects surge memory in destiny server


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 Alex


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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 :)

Best Alex


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]