6

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

Noam Rathaus
  • 5,405
  • 2
  • 28
  • 37
Aravinda
  • 495
  • 1
  • 7
  • 17
  • 2
    what does `/var/log/apache2/error.log` show? guessing you lack mod_rewrite and mod_headers enabled as a module – Noam Rathaus Dec 16 '13 at 13:18
  • 1
    I would agree with nrathaus. Try running `tail -f /var/log/apache2/error.log` to see the errors that are causing it. `tail` will watch the log file, so if you load the web page that produces the error again, you'll be able to see it in the console. – Goldentoa11 Dec 16 '13 at 13:20
  • 1
    [Mon Dec 16 08:22:49 2013] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.17 with Suhosin-Patch configured -- resuming normal operations [Mon Dec 16 08:22:58 2013] [alert] [client 192.168.176.128] /var/www/db/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration [Mon Dec 16 08:22:58 2013] [alert] [client 192.168.176.128] /var/www/db/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration – Aravinda Dec 16 '13 at 13:25
  • above is my error log.. Thanks for your swift replies.. really really appreciated your help.... – Aravinda Dec 16 '13 at 13:27

1 Answers1

10

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.

Manolo
  • 24,020
  • 20
  • 85
  • 130
  • 1
    What i did was run below things a2enmod rewrite headers and apache2ctl restart Now my htaccess is working – Aravinda Dec 16 '13 at 14:13