Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

305
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!