Question

.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/seonbinovels.com/public_html 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]
</IfModule>

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?

Subscribe
Share

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.

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.

Hi,

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 webmaster@archeoskins.com 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.”

It worked! Thank you so much!

Judging by that log you have problem with Better WP Minify plugin, that plugin is outdated anyway. Disable it and give that code in .htaccess a try.

Hello, thank you for such a quick answer, @milanbozic

I’ve tried creating a mutex directory in both /var/log/apache2 and /var/log/apache, but I not nothing from either of them.

Also, here is a part of the apache error log.

[Mon Aug 08 00:06:39.102129 2016] [:error] [pid 25184] [client 114.79.53.166:46801] PHP Warning:  fopen(/var/www/seonbinovels.com/public_html/wp-content/plugins/bwp-minify/cache/minify_woocommercelayout,woocommerce,style,style,bootstrap,fontawes_387a8dcdea67a42bcdec5a634e8d6454): failed to open stream: No such file or directory in /var/www/seonbinovels.com/public_html/wp-content/plugins/bwp-minify/min/lib/Minify/Cache/File.php on line 100, referer: http://seonbinovels.com/
[Mon Aug 08 00:06:39.102153 2016] [:error] [pid 25184] [client 114.79.53.166:46801] PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /var/www/seonbinovels.com/public_html/wp-content/plugins/bwp-minify/min/lib/Minify/Cache/File.php on line 101, referer: http://seonbinovels.com/
[Mon Aug 08 00:06:39.102159 2016] [:error] [pid 25184] [client 114.79.53.166:46801] PHP Warning:  stream_get_contents() expects parameter 1 to be resource, boolean given in /var/www/seonbinovels.com/public_html/wp-content/plugins/bwp-minify/min/lib/Minify/Cache/File.php on line 102, referer: http://seonbinovels.com/
[Mon Aug 08 00:06:39.102164 2016] [:error] [pid 25184] [client 114.79.53.166:46801] PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /var/www/seonbinovels.com/public_html/wp-content/plugins/bwp-minify/min/lib/Minify/Cache/File.php on line 103, referer: http://seonbinovels.com/