.htaccess crashes my wordpress website

Ok, I’ve struggled with this problem for several days now, and I don’t know how to fix it. Apparently I need to create an .htaccess file in order to allow my users to start accessing the posts and pages in my wordpress website, but adding an .htaccess in /var/www/ just crashes the website. No error 500 or anything. Straight up crashes the website.

Here’s the code that I put into htaccess, seemed pretty ok to me…

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

But the server just crashes. I’ve tried to see what was wrong by typing in apache2 -S in the console, but all I got was:

Apache error: Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

I don’t even know what that means… In any case, I checked that mod rewrite was indeed on, and I’ve also allowed overrides in 000-default.conf. And yet my site still crashes. Does anyone know how I can fix this…?

P.S. I’ve checked the apache2 error logs, and found hundreds of lines that said PHP warnings. I don’t know what that means or how I should fix it, but maybe that’s related to all this?

Submit an answer

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!

Sign In or Sign Up to Answer

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.

It might happen due to the W3TC Cache plugin as it modifies your .htaccess file to include all that info. You will need to remove this plugin and then use the above code of .htaccess.


can you display a part of apache log from /var/log/apache2? Do you have enough permissions on apache config for your sites? Try creating /var/log/apache/mutex writable directory and restart apache (service apache2 restart).

Kind regards, Milan Bozic.

i have put the expires header into .htaccess in worpress html using panel, when i add that and save that code. and went to my website url. its got crashed and given me the following error. “Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.”

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel