Search code examples
apachexampphttp-headers

XAMPP managing headers (server response headers)


I need to modify my localhost page server response (edit headers) - I'm using XAMPP (apache + msql, on linux machine). I can't find how to do that. Maybe some of the programmers/admins know how I can make it happened - share their knowledge and save me time.

If there is any article/link I would use it gladly.

I cannot use live server (my page is a total mess - it working on localhost by miracle...), and the only thing I have installed is xampp, so editing response headers through xampp would be perfect.

Thanks for any directions.

EDIT: https://www.a2hosting.com/kb/developer-corner/apache-web-server/modifying-http-headers

is not working for me.

<IfModule mod_headers.c>
  Header set Test "testing"
</IfModule>

inside of .htaccess


Solution

  • In you .htaccess file (witch should be placed where your index.html is) type:

    ### add custom header to all server responses from ALL files:
    Header add Custom-Header: "parameter=value"
    
    ### add custom header to SINGLE file:
    <Files someOtherFile.html>
      Header add Custom-Header: "parameter=value"
    </Files>
    

    I'm using linux, maybe on windows there is something more you should do but remember to restart xampp after editing .htaccess.