Question

When I add mod_expires rules in .htaccess file, I am getting 500 server error

I have installed WordPress from one click installation. I have enabled mod_expires and mod_headers. Now when I am trying to add mod_expires rule in .htaccess file, I am getting 500 server error.

error.log file says: /var/www/.htaccess: ExpiresActive not allowed here

What should I do now ?


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Kamal I was missing the <Directory /var/www/> and </Directory> part of the code. I now have it working on my subdomain.

I don’t have /etc/apache2/apache.conf but I do have /etc/apache2/apache2.conf is that the file I need to use for the main domain?

Thanks for this guys. I remembered that I had a subdomain with a .conf so I tested it there. I still got a 500 database error when I tried to add the code to that .htaccess file - and worse still I forgot to remove the AllowOverride line before I went to bed and my server crashed out in the night.

When I tried to restart Apache to it said:

AH00526: Syntax error on line 14 of /etc/apache2/sites-enabled/static.supermommyclub.com.conf: AllowOverride not allowed here Action ‘configtest’ failed.

I went in and removed the line and my site came back online.

I’m at a loss as to why I can’t get the mod_headers to work and also need to know why I am getting so many intermittent unable to connect to database errors. I am having far too much downtime.

Any hints onto what I can be checking for?