«

»

Oct 08

Legacy filter_module syntax causing 500 error in apache 2.4

Hey, sometimes you may come up with the following error in error log which is actually causing by legacy filter_module syntax on the htaccess file.


======================
[Sun Oct 06 18:20:24.119633 2013] [core:alert] [pid 47884] [client 5.x.x.x:54039] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.705923 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.707094 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
======================

Probably the apache version is 2.4 in your server and it wont take the legacy filter_module syntax. You should need to make some changes in it. For example my users filter_module rules were as follows in his .htaccess file.


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

I changed it to


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

The error has gone then 🙂

3 comments

  1. Jeroen

    Thank you sir!

    However, your method doesn’t work with a simple copy-and-paste, because the quotes get changed by WordPress.

    The comment form doesn’t seem to support the different type of quotes, so I can’t post a fix. Try to get it in a code or pre tag.

    1. penguinbliss

      Hey Jeroen, sorry man. But this is the exact fix for in apache 2.4. Now I have changed the quotes to correct one as wordpress editor had changed it while I was adding the post. Please try now.

  2. howdytom

    Just stumbled upon the same issue. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>