Host virtual Apache carrega página errada quando um caminho é usado

Host virtual Apache carrega página errada quando um caminho é usado

Eu tenho vários hosts virtuais configurados em meu servidor Apache (RedHat) que funcionam bem até que um caminho seja usado. Explicar.

Eu tenho:

  • https: //myserver1.com (site padrão)
  • https: //myserver2.com
  • https: //myserver3.com

Mas quando um usuário acessa qualquer um deles, ele obtém a página correta e o URL é anexado a /PORTAL/STARTUP.php

Mas se os usuários adicionarem sua página aos favoritos, por exemplo, https: //myserver3.com/PORTAL/STARTUP.php, eles chegarão ao site padrão, mas com o URL correto.

O que eu perdi?

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver1
    ServerName myserver1. com
    ErrorLog logs/myserver1-error_log
    CustomLog logs/myserver1-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver2
    ServerName myserver2.com
    ErrorLog logs/myserver2-error_log
    CustomLog logs/myserver2-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver3
    ServerName myserver3.com
    ErrorLog logs/myserver3_error_log
    CustomLog logs/myserver3_access_log common
</VirtualHost>

ATUALIZAR

<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<filesMatch "\.(html|htm|js|css|png)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

Header set X-Permitted-Cross-Domain-Policies: "master-only"
Header always set X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection: "1; mode=block"
Header set Access-Control-Allow-Origin "*"

<VirtualHost *:80>
    ServerName clientA.com
    DocumentRoot /var/www/html
    ErrorLog logs/clientA.com-error_log
    CustomLog logs/clientA.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    ServerName clientB.com:443
    DocumentRoot /var/www/html
    Redirect / https://clientB.com/
    ErrorLog logs/clientB.error_log
    CustomLog logs/clientB.access_log common
</VirtualHost>

#<VirtualHost *:443>
   # DocumentRoot /var/www/html/clientC
    #ServerName www.clientC.com
    #ErrorLog logs/clientB.com-error_log
    #CustomLog logs/clientB.com-access_log common
#</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientD
    ServerName clientD.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientE
    ServerName clientE.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientF
    ServerName clientF.com
    ErrorLog logs/clientF.com_error_log
    CustomLog logs/clientF.com_access_log common
</VirtualHost>

<VirtualHost *:443>
  DocumentRoot /var/www/html/clientG
  ServerName clientG.com
  ErrorLog logs/clientG_error_log
  CustomLog logs/clientG_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientH
    ServerName clientH.com
    ErrorLog logs/clientH_error_log
    CustomLog logs/clientH_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientI
    ServerName clientI.com
    ErrorLog logs/clientI_error_log
    CustomLog logs/clientI_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientJ
    ServerName clientJ.com
    ErrorLog logs/error_log
    CustomLog logs/access_log common
</VirtualHost>

<VirtualHost *:443>
    ProxyPreserveHost On
    ProxyPass / http://111.111.111.111/
    ProxyPassReverse / http://11.111.111.111/
    ServerName clientK.com
    ErrorLog logs/clientK_error_log
    CustomLog logs/clientK_access_log common
</VirtualHost>

Em seguida, as entradas vhost acima vão para os clientes até J

informação relacionada