Ayúdame a redirigir una URL en mod_rewrite

Ayúdame a redirigir una URL en mod_rewrite

Estoy configurando un nuevo servidor Linux. Me gustaría redirigir silenciosamente

www.domain.com/whateverawww.domain.com/flows/default/whatever

a menos que el flujo se especifique explícitamente, como

www.domain.com/flows/beta/whatever

Dentro de la entrada VirtualHost de mi dominio, tengo lo siguiente:

LogLevel error rewrite:trace6

<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
    RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,NC,R=301]

    RewriteCond %{REQUEST_URI} !^/flows/ [NC]
    RewriteRule ^ /flows/default%{REQUEST_URI} [NC]

</IfModule>

Donde "dominio.com" es mi dominio real obv.

Estas son las mismas dos reglas que siempre he usado en el pasado, sin embargo, algo no funciona ahora. Cualquier URL modificada por la segunda regla muestra una página 404 con un mensaje como el siguiente:

The requested URL /cgi-sys/ea-php70/index.php was not found on this server.

A mitad del registro de salida, se encuentra la siguiente línea:

init rewrite engine with requested uri /cgi-sys/ea-php70/index.php

No sé lo suficiente sobre cómo funciona todo para entender por qué CGI/PHP está involucrado en el procedimiento. Aquí está el registro completo:

[domain.com/sid#6de4c962d30][rid#70829c002970/initial] init rewrite engine with requested uri /index.php
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] applying pattern '^' to uri '/index.php'
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] RewriteCond: input='domain.com' pattern='^domain.com$' [NC] => matched
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] rewrite '/index.php' -> 'http://www.domain.com/index.php'
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] explicitly forcing redirect with http://www.domain.com/index.php
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] escaping http://www.domain.com/index.php for redirect
[domain.com/sid#6de4c962d30][rid#70829c002970/initial] redirect to http://www.domain.com/index.php [REDIRECT/301]
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] init rewrite engine with requested uri /index.php
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] applying pattern '^' to uri '/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] RewriteCond: input='www.domain.com' pattern='^domain.com$' [NC] => not-matched
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] applying pattern '^' to uri '/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] RewriteCond: input='/index.php' pattern='!^/flows/' [NC] => matched
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] rewrite '/index.php' -> '/flows/default/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] local path result: /flows/default/index.php
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] prefixed with document_root to /home/mario/public_html/flows/default/index.php
[www.domain.com/sid#6de4c962d30][rid#70829c002970/initial] go-ahead with /home/mario/public_html/flows/default/index.php [OK]
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] init rewrite engine with requested uri /cgi-sys/ea-php70/index.php
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] applying pattern '^' to uri '/cgi-sys/ea-php70/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] RewriteCond: input='www.domain.com' pattern='^domain.com$' [NC] => not-matched
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] applying pattern '^' to uri '/cgi-sys/ea-php70/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] RewriteCond: input='/cgi-sys/ea-php70/index.php' pattern='!^/flows/' [NC] => matched
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] rewrite '/cgi-sys/ea-php70/index.php' -> '/flows/default/cgi-sys/ea-php70/index.php'
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] local path result: /flows/default/cgi-sys/ea-php70/index.php
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] prefixed with document_root to /home/mario/public_html/flows/default/cgi-sys/ea-php70/index.php
[www.domain.com/sid#6de4c962d30][rid#70829c00be58/initial/redir#1] go-ahead with /home/mario/public_html/flows/default/cgi-sys/ea-php70/index.php [OK]
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] init rewrite engine with requested uri /404.shtml
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] applying pattern '^' to uri '/404.shtml'
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] RewriteCond: input='www.domain.com' pattern='^domain.com$' [NC] => not-matched
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] applying pattern '^' to uri '/404.shtml'
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] RewriteCond: input='/404.shtml' pattern='!^/flows/' [NC] => matched
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] rewrite '/404.shtml' -> '/flows/default/404.shtml'
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] local path result: /flows/default/404.shtml
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] prefixed with document_root to /home/mario/public_html/flows/default/404.shtml
[www.domain.com/sid#6de4c962d30][rid#70829c00ff58/initial/redir#2] go-ahead with /home/mario/public_html/flows/default/404.shtml [OK]

Entonces la pregunta oficial es, ¿por qué mi redireccionamiento no funciona y qué debo hacer para corregirlo?

Hágame saber si necesita cualquier otra información. Gracias chicos.

ACTUALIZAR

La configuración es CentOS, cPanel, Apache 2.4, MPM Event, PHP-FPM, PHP 7, suEXEC.

Bien, agregué RewriteCond %{REQUEST_URI} !^/cgi-sys/ [NC]la segunda regla solo para que funcione, y ahora funciona. Todavía me gustaría saber qué está pasando internamente solo para conocimiento personal si alguien tiene una idea.

información relacionada