Portal Home > Knowledgebase > Articles Database > Load instructions only file file exists in Apache2


Load instructions only file file exists in Apache2




Posted by juliovedovatto, 08-24-2011, 08:29 AM
I want to load some specific configs into my virtualhost blocks only if apache finds the file in vhost directory. There's a way to to this? I tried with but does not work. But only work if I enter the file into url directly. One of my vhost have a file that I need to put specific instructions. I want to make this more flexible, like in the future I need to use it again without editing another block. I want more conditional. Any help will be appreciated. Cheers

Posted by twikamltd, 08-25-2011, 03:31 AM
Use a wildcard? #Inside vhost Include /etc/httpd/vhosts/domain.com/exactfilename.* (make it as specific as possible so you dont go loading every file and causing errors, only the ones you're after) Not sure if it would work as never tried it but you get the idea.

Posted by anythingss, 08-25-2011, 11:59 AM
i think you may have fallen into the trap of asking for how to implement your solution instead of asking what it is that you want to do if i assume correctly, my answer is that I don't think what you're asking is possible. eg, apache cant change a core directive (eg, DocumentRoot) if it detects a file (eg, /var/www/html/xyz.tgz) exists you can however change environment variables, handlers and mime types in a rewrite rule. and you can use rewritecond to detect if a file exists.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
How to host a VPN? (Views: 556)
copyright breaking? (Views: 576)