Apache Error: Invalid Command in .htaccess (Module Not Enabled)
Modules.
Invalid command in .htaccess means the file uses a directive from an Apache module that is not loaded on your server. The site returns a 500 error until the line is wrapped or removed.
Step 1: Read the log

It says for example Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration. The quoted word is the directive.
Step 2: Match the directive to its module

ExpiresActive needs mod_expires, RewriteRule needs mod_rewrite, Header needs mod_headers, AddOutputFilterByType needs mod_filter.
Step 3: Wrap it in IfModule

Place the lines inside <IfModule mod_expires.c> and </IfModule>. If the module is missing, Apache skips the block instead of failing.
Step 4: Enable the module

On your own server run a2enmod expires (use the matching name) and systemctl restart apache2. On shared hosting ask support to enable it.
Step 5: Check spelling

A misspelled directive gives exactly the same error.
Step 6: Remove what you do not need

Delete rules copied from a tutorial that you do not use.
Step 7: Retest

Reload the site and check the log.
Still stuck?
If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.
Related guides
- Writing Clear Error Reports: Screenshots, URLs and Steps
- WordPress Tag and Date Archives Duplicate Content: Settings
- WordPress Permalinks Change: Redirect Old URLs and Avoid 404s
- Error Establishing a Database Connection in WordPress: Full Checklist