How to Resolve Apache’s “Either all Options must start with + or -” Error in .htaccess


2 views

Many Apache server administrators encounter this confusing error message when working with .htaccess files:

Either all Options must start with + or -, or no Option may.

The error occurs because Apache enforces strict syntax rules for the Options directive. There are three valid formats:

# Format 1: All options with + prefix
Options +SymLinksIfOwnerMatch +ExecCGI +Includes

# Format 2: All options with - prefix
Options -Indexes -MultiViews

# Format 3: Plain options without prefixes
Options Indexes FollowSymLinks

The problematic line mixes multiple formats:

Options +SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC ... -Indexes

This violates Apache's syntax rules by combining prefixed and non-prefixed options.

Solution 1: Consistent Prefixing

Options +SymLinksIfOwnerMatch +ExecCGI +Includes +IncludesNOEXEC -Indexes

Solution 2: Remove All Prefixes

Options SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC

Let's break down the functionality:

  • SymLinksIfOwnerMatch: Follows symbolic links only if owner matches
  • ExecCGI: Allows execution of CGI scripts
  • Includes: Enables SSI (Server Side Includes)
  • IncludesNOEXEC: Allows SSI but disables exec/cgi in them
  • Indexes: Shows directory listing when no index file exists
# Recommended minimal configuration for most cases
Options +SymLinksIfOwnerMatch -Indexes -MultiViews

Remember that each + or - modifies the option from the parent configuration level.

If you're still having issues:

  1. Check for duplicate Options directives
  2. Verify you're using Apache 2.4+ (syntax differs in older versions)
  3. Test configurations in httpd.conf first before moving to .htaccess

Using .htaccess files has performance overhead. For better performance:

# In httpd.conf
<Directory /path/to/your/site>
    Options +SymLinksIfOwnerMatch -Indexes
    AllowOverride None
</Directory>

When working with Apache's .htaccess files, one common syntax error occurs with the Options directive. The error message you're seeing:

Either all Options must start with + or -, or no Option may

This happens because of inconsistent syntax in specifying options. Let's examine the problematic line:

Options +SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch ExecCGI  Includes  IncludesNOEXEC  SymLinksIfOwnerMatch  Indexes -Indexes

Apache's Options directive has strict syntax rules:

  • All options must either:
    • Use prefix notation (+/- for all options)
    • Or use no prefixes at all (all options unprefixed)
  • You cannot mix prefixed and unprefixed options in the same directive

Here's the corrected version using prefix notation:

Options +SymLinksIfOwnerMatch +ExecCGI +Includes +IncludesNOEXEC -Indexes

Or alternatively, without prefixes:

Options SymLinksIfOwnerMatch ExecCGI Includes IncludesNOEXEC

The original configuration (after removing duplicates) appears to be trying to:

  • Enable symbolic links when owner matches (+SymLinksIfOwnerMatch)
  • Allow CGI script execution (+ExecCGI)
  • Enable server-side includes (+Includes)
  • Enable server-side includes but without exec (+IncludesNOEXEC)
  • Disable directory listing (-Indexes)

Here's a more optimized version:

Options +SymLinksIfOwnerMatch +ExecCGI +IncludesNOEXEC -Indexes

Note: +IncludesNOEXEC already implies server-side includes without execution, making +Includes redundant.

1. Keep it minimal - only enable what you need:

Options +FollowSymLinks -Indexes

2. Use + notation when you want to add options to parent configuration:

Options +ExecCGI

3. Use - notation when you want to remove options:

Options -Indexes -Includes

4. Never duplicate options in the same directive (as in original example).

After making changes:

  1. Test syntax with: apachectl -t
  2. Check for errors in Apache error logs
  3. Verify each option's effect on your server behavior

Remember that Options directives are inheritable, so parent directory configurations may affect your settings unless you use Options +|-[option] syntax to explicitly add or remove options.