Internal 500 Server Error After Activating W3 Total Cache WordPress Plugin
If you’ve ever built, or are in the process of building, a site in WordPress I trust you’ve added a caching plugin. The increase in speed and reduction on server load is definitely worth it so, if you haven’t added one, I recommend you do go and do so now. Go on, I’ll wait for you here…
On my latest site I used the W3 Total Cache plugin. I added the files, activated it through the ‘Plugins’ page, and… uh oh… I immediately got presented with a ‘Server Error’ page. The error showed on all pages, both front end and back end, meaning I couldn’t access anything.
The Attempted Solution
My first thought was to remove the ‘w3-total-cache’ folder from the ‘/wp-content/plugins’ directory, effectively deactivating the plugin. This however didn’t work so I had to dig a little deeper.
The Real Solution
My next port of call was the apache error log. I opened up the logs and the last entry was as follows:
[Fri Jun 14 15:42:09.616166 2013] [core:alert] [pid 2684:tid 1652] [client ::1:55572] C:/xampp/htdocs/my-site/.htaccess: # without matching
As you can see, the error states that the problem lies in the .htaccess file of the site. After opening up the .htaccess file in question I could immediately see the problem. See if you can spot the problem below:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<IfModule mod_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>
</IfModule>
</IfModule>
# END W3TC Browser Cache
Can you see it? On line 8 you’ll notice that the W3 Total Cache plugin has added it’s own entries to the .htaccess upon being activated. This is great but it hasn’t added a line break and has just appended it to the end of the existing .htaccess content. We therefore end up with the following:
</IfModule># BEGIN W3TC Browser Cache
After adding the required line breaks the site then immediately became accessible again.
Thank you brother. It really help me>>>>>>Thank you Very Much.
Perfect. This fixed it. :)
Thank man you save my life!
Thanks so much for that tip! There were all these other things on forums that didn’t do a thing, but your solution is so simple and worked right away!
Thanks so much, dude! You’ve just saved me from doing tons of work :)!
I was facing the same problem and I have final solved it by changing PHP version:
http://www.maxxpreston.pl/web/internal-server-error-wordpress/
@jonas – Simply add a line break (ie. a new line) on this line:
RewriteRule . index.php [L]# BEGIN W3TC Browser Cache
Before the hash (#).
Hi,
I got this problem and 500 international server error after activating w3 total cache, right now. And i am abit confused about how to fix it because my .htaccess file doesnt seem to be exact like yours.
What do i need to edit to get it work again?
My .htaccess file is following:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]# BEGIN W3TC Browser Cache
Header append Vary User-Agent env=!dont-vary
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
# END W3TC Browser Cache
—
I hope you will answer me, because i am scared as hell.
Kind regards,
Jonas Donbæk
You saved my time :)
thanks for this article…
I really love it !!
keep it up good work !! :)
Wonderful, I was just about to delete it.
Thank you Steve,
you have saved my day!
I knew the problem was .htacces but didn’t see the missing line break.