How to remove header content-type in apache ?
The following code does not work
header_remove('content-type');
Try
<?php
header('Content-Type:');
This completely removed the Content-Type
header from the response. Like you, using header_remove()
didn't do a thing and Hereblur's answer left me with Content-Type: none
in the response.
It depends on what php.ini directives you have, and what PHP you use (CLI, CGI, ...).
This answer is based on PHP 5.4, running in CGI.
Note in php.ini:
default_mimetype = text/html
That's the default value, that PHP sends as:
Content-Type: text/html
If you want to get rid of it, you have to remove the default value by creating the header again, then you can remove the header:
<?php
header('Content-Type: text/html');
header_remove('Content-Type');
Try this.
header("content-type: none");
I don't know why, but it's worked for me.
I cannot find any reference mentioned about this. but it's simply removed the content-type
from header for me. It' may be apache's bug or PHP's bug. So try it and use it with careful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With