apache.htaccessbacktrack-linux

Can somebody please help me to avoid internal server error | htaccess | apache2ctl | backtrack


Im new to stackowerflow as well as apache and im sorry if i have placed this thread in a wrong place..

Can somebody please help me to avoid internal server error | htaccess | apache2ctl | backtrack

What i wanted to do was to add these lines to htaccess.. My htaccess and webserve is working fine without these lines.. but i need to add them to the htaccess

RewriteEngine on
RewriteCond %{REQUEST_METHOD}^(TRACE|TRACK)
RewriteRule .* - [F]

Header set X-Frame-Options Deny
Header always append X-Frame-Options SAMEORIGIN**

as soon as i enter above lines it gives me this error when i refresh web

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.14 (Ubuntu) Server at 192.168.176.130 Port 80

Can somebody kindly give some advice please? any help would be highly appreciated...


Solution

  • 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.