How to remove header content-type in apache ?
The following code does not work
header_remove('content-type');
How to remove header content-type in apache ?
The following code does not work
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.
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 are using the bellow line and do not have access to php.ini:
#!/usr/local/bin/php
You can add -q
at the end of it and the headers will be removed, because header_remove
will not remove Content-type.
#!/usr/local/bin/php -q
© 2022 - 2024 — McMap. All rights reserved.