1

I am monitoring my website (faghatseo.com) 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. enter image description here The error is like this

Please contact the server administrator at webmaster@faghatseo.com 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?

1
  • keep alive has to be used in some cases , you have to make sure you need it first .. Dec 26 '17 at 7:27
1

Check out wp_headers filter:

/**
 * Filter WordPress headers before sent
 *
 * @see  https://developer.wordpress.org/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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.