Report this

What is the reason for this report?

Mod_rewrite 301 redirects surge memory in destiny server

Posted on August 2, 2015

Hi,

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/ https://www.newdomain.com/new-url/ [L,R=301,NC]

I really need some help.

Thanks in advance Alex



This textbox defaults to using Markdown to format your 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,

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} ^www.olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$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 :)

Best Alex

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.