Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

308
Visualizações
Apache: "Virtualhost not allowed here" error when using If condition

I have a condition inside httpd.conf that looks like this:

<If "-f '/some/path/to/existing/file'">
   <VirtualHost _default:$port1>
     ServerName example.com

     ...config1...
   </VirtualHost>
</If>
</Else>
   <VirtualHost _default:$port1>
     ServerName example.com

     ...config2...
   </VirtualHost
</Else>

However, it's giving me a syntax error AH00526 that says "VirtualHost not allowed here". If I comment out the "If Else" condition, and put a VirtualHost outside the block, it works.

How could I fix this while keeping the condition?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You could try the following. Instead of using If directives (which are really intended for checking request parameter, you could try using the IfFile directive.

IfFile checks if a file exists at startup. It has no else option, so you will need to make sure your file checks are exclusive for each server.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda