Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internal Server Error - htaccess

Tags:

.htaccess

wamp

I have a htaccess file that it work perfectly on host but when I put it on local ,it shows me this error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@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.

I found this alert in error log file :

[Tue Apr 17 10:02:25 2012] [alert] [client 127.0.0.1] D:/wamp/www/jivan/sql/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration

this is my htaccess file code:

  RewriteEngine On AddDefaultCharset utf-8 RewriteRule ^([0-9-]+)/keyword_show.html$ keyword_show.php?keyword_id=$1 RewriteRule ^page_(.*).html$  page.php?url=$1 RewriteRule ^([0-9-]+)/(.*)/(.*)/(.*).html$ $2.php?advertisement_cat=$1&id=$3&pagenumber=$4 RewriteRule ^([0-9-]+)/(.*)/(.*).html$ $2.php?advertisement_cat=$1&pagenumber=$3 RewriteRule ^([0-9-]+)/(.*).html$ $2.php?advertisement_cat=$1 # cache images and flash content for one month <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$"> Header set Cache-Control "max-age=2592000" </FilesMatch>  # cache text, css, and javascript files for one month <FilesMatch ".(js|css|pdf|txt)$"> Header set Cache-Control "max-age=2592000" </FilesMatch> 

my local server run by wamp and I enabled rewrite module too!!!

so what`s the prob?!!

like image 226
afsane Avatar asked Apr 17 '12 05:04

afsane


People also ask

What can cause internal server error?

What causes a 500 Internal Server error. This error means there is a problem on the server side. A server error can be caused by any number of things from uploading the incorrect file to as bug in a piece of code. This error response is a generic "catch-all" response.


2 Answers

the Header directive is in the mod_headers apache module. You need to make sure that module is loaded into the apache server.

like image 81
Michael Slade Avatar answered Sep 28 '22 06:09

Michael Slade


Steps to enable HEADERS modules

$ cd /etc/apache2/mods-available $ sudo a2enmod headers $ /etc/init.d/apache2 restart 
like image 30
Allahbakash.G Avatar answered Sep 28 '22 08:09

Allahbakash.G