13

Not long ago, I moved from xampp to wamp
And now when I entered my website this error has appeared:

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.

When I used this code in .htaccess:

<FilesMatch "\.(pdf|swf|js|css)$">
    Header set Cache-Control "max-age=604800"
</FilesMatch>

<FilesMatch "\.(html|cgi|php|htm)$">
    Header set Expires "Thu, 01 Dec 2003 16:00:00 GMT"
    Header set Cache-Control "no-store, no-cache, must-revalidate"
    Header set Pragma "no-cache"
</FilesMatch>


AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html

<Files *.js>
    SetOutputFilter DEFLATE
</Files>

<Files *.css>
    SetOutputFilter DEFLATE
</Files>  

How can I fix this problem?


I found apache_error.log:

[Sat Jan 07 13:58:06 2012] [alert] [client 127.0.0.1] C:/wamp/www/website/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: localhost

Adam Lear
  • 38,111
  • 12
  • 81
  • 101
user1123379
  • 334
  • 3
  • 5
  • 13

8 Answers8

26

In wamp server click on apache ,apache modules and click(mark) on the rewrite_module and restart wamp server your problem is solved

21

As XP1 said, the answer to this is to enable headers_module in WAMP.

Either use the WAMP interface or add this to your httpd.conf

LoadModule headers_module modules/mod_headers.so
Rob Forrest
  • 7,329
  • 7
  • 52
  • 69
11

If enabling mod_headers didn't fix your problem, then it is being caused by AddOutputFilterByType

This can be fixed by enabling another module, mod_filter.

Probably also a good idea to add the 'ifModule' code if your server settings ever get reset or you migrate your project to a different server. This worked for me:

<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
JBS
  • 639
  • 7
  • 17
3

After a lot of searching in WAMP, the headers module did not enable mod_headers module. You can enable the mod_headers in httpd.conf file. At start a list of modules are shown just find mod_header and remove the # at start of it and restart WAMP. Now the mod_headers module will be enabled and loaded.

Shiva Avula
  • 1,836
  • 1
  • 20
  • 29
1

Go To Wampmanger LeftClick , Apache Then ApacheModules and check (rewrite_module) , Restart Apache ,then it will be ok

Ahmed Deeb
  • 11
  • 3
1

Add this and the code should work fine

    <IfModule mod_expires.c>
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2628000, public"
</filesMatch>
</IfModule>
Ankit Anand
  • 151
  • 1
  • 3
  • I think it should be `mod_headers.c` instead of `mod_expires.c` since you are using "Cache-Control: max-age" caching and not "Expires" caching. – Prits Pri Teish Jan 20 '18 at 22:21
0

I think to execute the commands in .htaccess files the rewrite module of the apache should be enabled but it is disabled by default.

If you are using WAMP then just click on the wamp server icon in the taskbar -> Apache -> Apache Modules. This will show you the list of modules.Then scroll down to find rewrite_module and click on it. When u click on it WAMP gets restarted with rewrite_module enabled.

So I think if you activate this module then it might solve your problem.

David
  • 15,894
  • 22
  • 55
  • 66
SwR
  • 612
  • 1
  • 8
  • 21
0

sometimes the space between location and url is the solution for example:

header('Location:usertimeline.php');

gives no error as opposed to

header('Location:   usertimeline.php');

I am a beginner on WAMP because my header module and all the stuff were ticked but in just doing this It was over.