admin管理员组

文章数量:1426975

I am monitoring my website (faghatseo) seeing an error about keep alive. I googled this problem, as an solution, there was a code

<IfModule mod_headers.c>
Header set Connection keep-alive 
</IfModule>

that you had to place in the .htaccess file in this direction below: /public_html/.htaccess

when I placed the code, error 500 appeared and my website went down!

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. The error is like this

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Obviously, I do not have access to Apache cause i'm using shared hosting service.

Is there any other way to enable keep alive with Cpanel or something?

I am monitoring my website (faghatseo) seeing an error about keep alive. I googled this problem, as an solution, there was a code

<IfModule mod_headers.c>
Header set Connection keep-alive 
</IfModule>

that you had to place in the .htaccess file in this direction below: /public_html/.htaccess

when I placed the code, error 500 appeared and my website went down!

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. The error is like this

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Obviously, I do not have access to Apache cause i'm using shared hosting service.

Is there any other way to enable keep alive with Cpanel or something?

Share Improve this question edited Dec 26, 2017 at 13:53 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Dec 26, 2017 at 7:22 S.A.F.S.A.F. 414 bronze badges 1
  • keep alive has to be used in some cases , you have to make sure you need it first .. – Alireza Amrollahi Commented Dec 26, 2017 at 7:27
Add a comment  | 

1 Answer 1

Reset to default 1

Check out wp_headers filter:

/**
 * Filter WordPress headers before sent
 *
 * @see  https://developer.wordpress/reference/hooks/wp_headers/
 */
function wpse_289493($headers, $wp)
{
    foreach ($headers as $key => $value) {
        if ('connection' === strtolower($key)) {
            unset($headers[$key]);
        }
    }

    $headers['Connection'] = 'Keep-Alive';

    return $headers;
}

// Add filter
add_filter('wp_headers', 'wpse_289493', 10, 2);

本文标签: htaccessHow can I enable keep alive (Not accessing to Apache)