Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm adding some redirects from old URLs. I add them to .htacces and they work fine. Then after a couple of minutes I will get

Error establishing a database connection after adding redirects

The only way to get the site working again is removing the redirects, than after a few minutes the site works again.

What could be causing this?

Here is my htaccess:

RewriteEngine On
## 301 Redirects of old URLs
# 301 Redirect 1
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/$ http://www.example.com/? [R=301,NE,NC,L]

# 301 Redirect 2
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/about\.html$ /about-us/? [R=301,NE,NC,L]

# 301 Redirect 3
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/accesscontrol\.htm$ /access-control/? [R=301,NE,NC,L]

# 301 Redirect 4
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/audiovideo\.htm$ /audio-video/? [R=301,NE,NC,L]

# 301 Redirect 5
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/audiovideor\.htm$ /audio-video/? [R=301,NE,NC,L]

# 301 Redirect 6
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/cctv\.htm$ /cctv/? [R=301,NE,NC,L]

# 301 Redirect 7
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/commercial\.html$ /commercial/? [R=301,NE,NC,L]

# 301 Redirect 8
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/book\.htm$ /contact-us/? [R=301,NE,NC,L]

# 301 Redirect 9
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/Directions\.htm$ /direction/? [R=301,NE,NC,L]

# 301 Redirect 10
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/fire\.htm$ /fire-alarms/? [R=301,NE,NC,L]

# 301 Redirect 11
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/links\.html$ /links/? [R=301,NE,NC,L]

# 301 Redirect 12
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/special\.html$ /news/? [R=301,NE,NC,L]

# 301 Redirect 13
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/home\.html$ /residential/? [R=301,NE,NC,L]

# 301 Redirect 14
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^sitemap\.html$ /sitemap/? [R=301,NE,NC,L]

# 301 Redirect 15
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/staffattack\.htm$ /staff-attack/? [R=301,NE,NC,L]

# 301 Redirect 16
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/whyinstallr\.htm$ /why-install/? [R=301,NE,NC,L]

# 301 Redirect 17
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/testimonials\.htm$ /why-use/? [R=301,NE,NC,L]

# 301 Redirect 18
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/whyuse\.html$ /why-use/? [R=301,NE,NC,L]

# 301 Redirect 19
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/whyuseh\.html$ /why-use/? [R=301,NE,NC,L]

# 301 Redirect 20
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/whyuser\.html$ /why-use/? [R=301,NE,NC,L]

# 301 Redirect 21
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/service\.htm$ /why-use/customised-service/? [R=301,NE,NC,L]

# 301 Redirect 22
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/expertise\.htm$ /why-use/expertise/? [R=301,NE,NC,L]

# 301 Redirect 23
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/reliable\.htm$ /why-use/reliability/? [R=301,NE,NC,L]

# 301 Redirect 24
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/value\.htm$ /why-use/value-for-money/? [R=301,NE,NC,L]

# 301 Redirect 25
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^pages/because/guarantee\.htm$ /why-use/? [R=301,NE,NC,L]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.