code: private static function parseContextPrefix(Request &$request, $serverVars = array())
      {
          // Since apache 2.3.13 we have now an additional index which provides the context
          if (isset($serverVars['CONTEXT_PREFIX']) && $serverVars['CONTEXT_PREFIX'] != '') {
              $request->setContextPrefix( $serverVars['CONTEXT_PREFIX'] . '/' );
          } elseif (isset($serverVars['REDIRECT_BASE'])) {
              // Try to determine the context from redirect base
              $request->setContextPrefix ( $serverVars['REDIRECT_BASE'] );
          } elseif (isset($serverVars['SCRIPT_FILENAME']) && isset($serverVars['SCRIPT_NAME'])) {
              // Fallback - get context out of script path
              if (isset($serverVars['HTTP_HOST'])) {
                  $scriptName = preg_replace('/^.+[\\\\\\/]/', '', $serverVars['SCRIPT_FILENAME']);
                  $request->contextPrefix = str_replace($scriptName, '', $serverVars['SCRIPT_NAME']);
              }
          }
      }
docs: Parse the context prefix variables to determine in which path
  context the request has been performed.
  
  @param Request $request