• Resolved Thomas Due Halfdaner

    (@taxick)


    Hi

    Sometimes my WordPress makes a PHP 500 Error code, and my site breaks down

    Here is my Apache log.

    [Thu Jan 29 19:10:44.349306 2026] [core:alert] [pid 1346957:tid 127027923211968] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:46.860051 2026] [core:alert] [pid 1346957:tid 127027948439232] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:47.310834 2026] [core:alert] [pid 1346957:tid 127028124866240] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:47.514840 2026] [core:alert] [pid 1346957:tid 127027931621056] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:47.639367 2026] [core:alert] [pid 1346957:tid 127028116473536] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:47.848912 2026] [core:alert] [pid 1346957:tid 127028108080832] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.122628 2026] [core:alert] [pid 1346957:tid 127028099688128] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.233608 2026] [core:alert] [pid 1346957:tid 127028091295424] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.417968 2026] [core:alert] [pid 1346957:tid 127028082902720] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.550996 2026] [core:alert] [pid 1346957:tid 127028074510016] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.786529 2026] [core:alert] [pid 1346957:tid 127028066117312] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:48.961401 2026] [core:alert] [pid 1346957:tid 127028057724608] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.086993 2026] [core:alert] [pid 1346957:tid 127028049331904] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.236510 2026] [core:alert] [pid 1346957:tid 127028040939200] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.378923 2026] [core:alert] [pid 1346957:tid 127028024121024] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.488682 2026] [core:alert] [pid 1346957:tid 127028015711936] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.592591 2026] [core:alert] [pid 1346957:tid 127028032530112] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.711399 2026] [core:alert] [pid 1346957:tid 127027998893760] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.850037 2026] [core:alert] [pid 1346957:tid 127027990484672] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code
    [Thu Jan 29 19:10:49.977233 2026] [core:alert] [pid 1346957:tid 127027982075584] [remote 5.186.54.***:30858] /home/mysite/public_html/.htaccess: ExpiresByType takes two arguments, a MIME type followed by an expiry date code

    To fix the PHP 500 Errors, i need to remove this from my .htaccess

    When the code is removed my .htaccess its works agian!

    # Expires headers (for better cache control)
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest "access plus 0 seconds"
    # Your document html
    ExpiresByType text/html "access plus 0 seconds"
    # Data
    ExpiresByType text/xml "access plus 0 seconds"
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType application/json "access plus 0 seconds"
    # Feed
    ExpiresByType application/rss+xml "access plus 1 hour"
    ExpiresByType application/atom+xml "access plus 1 hour"
    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon "access plus 1 week"
    # Media: images, video, audio
    ExpiresByType image/gif "access plus 4 months"
    ExpiresByType image/png "access plus 4 months"
    ExpiresByType image/jpeg "access plus 4 months"
    ExpiresByType image/webp "access plus 4 months"
    ExpiresByType video/ogg "access plus 4 months"
    ExpiresByType audio/ogg "access plus 4 months"
    ExpiresByType video/mp4 "access plus 4 months"
    ExpiresByType video/webm "access plus 4 months"
    ExpiresByType image/avif "access plus 4 months"
    ExpiresByType image/avif-sequence "access plus 4 months"
    # HTC files (css3pie)
    ExpiresByType text/x-component "access plus 1 month"
    # Webfonts
    ExpiresByType font/ttf "access plus 4 months"
    ExpiresByType font/otf

    My full .htaccess file

    # BEGIN Really Simple Auto Prepend File
    <IfModule mod_php7.c>
    php_value auto_prepend_file /home/mysite/public_html/wp-content/advanced-headers.php
    </IfModule>
    <IfModule mod_php.c>
    php_value auto_prepend_file /home/mysite/public_html/wp-content/advanced-headers.php
    </IfModule>
    <Files ".user.ini">
    <IfModule mod_authz_core.c>
    Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
    </IfModule>
    </Files>
    # END Really Simple Auto Prepend File
    # BEGIN Really Simple Security Redirect

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>

    # END Really Simple Security Redirect

    # BEGIN Imagify: webp file type
    <IfModule mod_mime.c>
    AddType image/webp .webp
    </IfModule>
    # END Imagify: webp file type

    # BEGIN Imagify: avif file type
    <IfModule mod_mime.c>
    AddType image/avif .avif
    </IfModule>
    # END Imagify: avif file type

    # BEGIN WP Rocket
    # Use UTF-8 encoding for anything served text/plain or text/html
    AddDefaultCharset UTF-8
    # Force UTF-8 for a number of file formats
    <IfModule mod_mime.c>
    AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
    </IfModule>

    # FileETag None is not enough for every server.
    <IfModule mod_headers.c>
    Header unset ETag
    </IfModule>

    # Since we’re sending far-future expires, we don’t need ETags for static content.
    # developer.yahoo.com/performance/rules.html#etags
    FileETag None

    <IfModule mod_alias.c>
    <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
    <IfModule mod_headers.c>
    Header set X-Powered-By "WP Rocket/3.20.3"
    Header unset Pragma
    Header append Cache-Control "public"
    Header unset Last-Modified
    </IfModule>
    </FilesMatch>

    <FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
    <IfModule mod_headers.c>
    Header unset Pragma
    Header append Cache-Control "public"
    </IfModule>
    </FilesMatch>
    </IfModule>

    <IfModule mod_mime.c>
    AddType image/avif avif
    AddType image/avif-sequence avifs
    </IfModule>
    # Expires headers (for better cache control)
    <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest "access plus 0 seconds"
    # Your document html
    ExpiresByType text/html "access plus 0 seconds"
    # Data
    ExpiresByType text/xml "access plus 0 seconds"
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType application/json "access plus 0 seconds"
    # Feed
    ExpiresByType application/rss+xml "access plus 1 hour"
    ExpiresByType application/atom+xml "access plus 1 hour"
    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon "access plus 1 week"
    # Media: images, video, audio
    ExpiresByType image/gif "access plus 4 months"
    ExpiresByType image/png "access plus 4 months"
    ExpiresByType image/jpeg "access plus 4 months"
    ExpiresByType image/webp "access plus 4 months"
    ExpiresByType video/ogg "access plus 4 months"
    ExpiresByType audio/ogg "access plus 4 months"
    ExpiresByType video/mp4 "access plus 4 months"
    ExpiresByType video/webm "access plus 4 months"
    ExpiresByType image/avif "access plus 4 months"
    ExpiresByType image/avif-sequence "access plus 4 months"
    # HTC files (css3pie)
    ExpiresByType text/x-component "access plus 1 month"
    # Webfonts
    ExpiresByType font/ttf "access plus 4 months"
    ExpiresByType font/otf
    # BEGIN Really Simple Security Disable directory indexing
    # Direktiverne (linjer) mellem 'BEGIN Really Simple Security Disable directory indexing' og 'END Really Simple Security Disable directory indexing' er
    # dynamisk genereret og bør kun ændres via WordPress-filtre.
    # Eventuelle ændringer i direktiverne mellem disse markører vil blive overskrevet.
    # Disable directory indexing to prevent listing of directory contents
    Options -Indexes
    # END Really Simple Security Disable directory indexing

    I hope someone can help me fix this error.

    Regards

    Thomas

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator threadi

    (@threadi)

    First of all: the error has nothing to do with WordPress. Although the .htaccess file is generated by WordPress, it does not contain these lines of code. They must either be added manually or originate from a plugin you are using.

    The message you are receiving comes from the Apache web server you are using, which is attempting to read the .htaccess file and encountering an error. The error is also clearly stated: a line for the Apache-own command ExpiresByType must be a MIME type followed by your expiration date code.

    Looking at the code you mentioned, it is not complete. I am unsure whether this happened during copying or whether it is really incorrect in the file. The very last line is incorrect:

    ExpiresByType font/otf

    You now have the following options:

    • If you want to continue using the code in your project, you should find out where it comes from. This code must be corrected at the source. If it is a plugin, contact the support team for the plugin in question. If someone is inserting it manually, point out the error to them.
    • If you don’t want to continue using the code, simply remove it. Then observe whether it reappears – if so, find the cause and prevent the file from being modified again.
    Thread Starter Thomas Due Halfdaner

    (@taxick)

    Hi,

    Thanks for the reply 🙂

    I changed this:

    ExpiresByType font/otf 
    ExpiresByType font/otf  "access plus 4 months"

    Now it works. – I will try to monitor what plugin that make the error.

    // Thomas

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.