Welcome to Rise Forums

Join our fantastic community to connect with like-minded website owners, WordPress users, and online entrepreneurs.

When Adding Filesmatch To .htaccess Get 500 Error! What Is Wrong?

Discussion in 'WordPress Questions & Support' started by Carlos Pinho, Aug 15, 2017.

Thread Status:
Not open for further replies.
  1. Each time I try to add the below to the .htaccess my site goes down. Any ideas? I really don't know what is going on. do i need to enable any conf to apache2? My WordPress install is based on LAMP with Ubuntu 16.04

    <filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|woff|svg)$">
    Header set Cache-Control "max-age=604800, public"

    Thank you very much in advanced.

  2. First things first: NEVER PUT UNTESTED CODE DIRECTLY ON PRODUCTION. Seriously, setup test server that is as close to production in setup as possible, and test anything you want to do there first. That way, if things go wrong, none of your users notice while you figure out what went wrong :)

    I tried this on a local XAMPP setup, didn't have any issues - so sadly it's not something obvious :(. Any 500 errors should be placed (with the appropriate error message) in your error log file, though - default location is /var/log/apache2/error.log, if not there check /etc/php5/apache2/php.ini.

    If the error message isn't enough, copy/paste it here and we'll go from there.
    Carlos Pinho likes this.
  3. I agree with @k06mars , You should check your error log.

    Though the htaccess code you have written is valid. In my opinion there may be 2 reason for 500 errors

    1. You may have copy pasted the code form some unrecognized encoding format. In this case, first copy code in simple notepad and then copy back in your server htaccess file.


    2. I think mode_headers directive from Apache is not enabled on your server. Contact your hosting technical team and ask them if they can enable it.
    Carlos Pinho likes this.
  4. Hello guys

    Has been a while since I posted this question, and missed to reply to it. I could find the problem, i hadn't the mod_headers enabled in Apache and that was the problem.
    Thank you for your help and assistance.
    Sanjay Ojha likes this.
Thread Status:
Not open for further replies.

Share This Page