Using an Apache server you can create Virtual Hosts, where you can redirect a server URL to be served from another directory as mentioned in this apache documentation
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
In this example file two applications run on the same server with different urls and different directories, the URL does not necessarily need to be different domains, may be just folders, I’ve done using only different folders.
The Documentroot for you will be the folder where the Windows is, the servername is your url. For this it is worth taking a look at the Alias and Directory directives that control access to URL.
Still regarding the Configuration files because they are not in the public folder they should already be safe, if you believe you need more security you can pass the settings to the Apache as environment variables and accessing them through PHP with $_ENV.
If you are using NGINX it also allows this type of operation.
I managed to solve this problem easily using Jelastic service from Locaweb. Thank you very much.
– Adriano de Azevedo