First of all, you need to enable the needed apache modules:
a2enmod rewrite headers
Then, in apache configuration, you can execute only if the needed module is enabled:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD}^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
<IfModule mod_headers.c>
Header set X-Frame-Options Deny
Header always append X-Frame-Options SAMEORIGIN**
</IfModule>
Restart your Apache server:
service apache2 restart
If still have an error do:
tail /var/log/apache2/error.log
You'll see the detailed error.