We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[SOLVED]How to make my Phalcon folder accessible by many virtual hosts?

Dear experts,

How to make my Phalcon folder accessible by many virtual hosts?

I want to point my domain1.com, domain2.com, domain3.com point to the same my application (Phalcon) folder, but in config.php, I was only able to set single 'baseUri'=> 'https://domain1.com'. It was keeping redirect to domain1.com when I access to domain2.com.

Thank you

Jim



1.2k
Accepted
answer

what if

$config = array(
// ...
    'baseUri' => 'https://' . rtrim(strtolower($_SERVER['HTTP_HOST']), '.'),
);

?

@Vladimir That's beautiful.

Thanks a lot. You're best :)



61

@Jimmy, Please do sanitize that SERVER variable. It can't be trusted! https://stackoverflow.com/questions/6474783/which-server-variables-are-safe