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

The root folder

Please help me set up the root folder. The site works if the files are in the folder - mysite/

But the site doesn't work if the files are located - mysite/folder1/ or mysite/folder2/.

How can I make the folder itself the root directory for every folder within a domain? sorry for my English)

What behaviour are you wanting?

  1. The user visits www.mysite.com/folder1, the app you've built in folder1 gets run, and the user sees all the urls as www.mysite.com/folder1/...?
  2. The user visits www.mysite.com/, the app you've built in folder1 gets run, but the user sees all the urls as www.mysite.com/...?

well if your tring to make to apps sepratly on the root folder for the apache you just need to add it to vhosts of apache and the computer hosts.

example vhosts:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:https://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
        DocumentRoot "/Users/hudson/Sites/batistoni"
        ServerName batistoni.local
        ErrorLog "/private/var/log/apache2/ph.local-error_log"
        CustomLog "/private/var/log/apache2/ph.local-access_log" common

        <Directory "/Users/hudson/Sites/batistoni">
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>
#
<VirtualHost *:80>
        DocumentRoot "/Users/hudson/Sites/phalcon"
        ServerName myphalcon.local
        ErrorLog "/private/var/log/apache2/ph.local-error_log"
        CustomLog "/private/var/log/apache2/ph.local-access_log" common

        <Directory "/Users/hudson/Sites/phalcon">
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>
#
<VirtualHost *:80>
        DocumentRoot "/Users/hudson/Sites/devsforrent"
        ServerName devsforrent.local
        ErrorLog "/private/var/log/apache2/devsforrent.local-error_log"
        CustomLog "/private/var/log/apache2/devsforrent.local-access_log" common

        <Directory "/Users/hudson/Sites/devsforrent">
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>
#
<VirtualHost *:80>
        DocumentRoot "/Users/hudson/Sites/phalcon-skeleton"
        ServerName skeleton.local
        ErrorLog "/private/var/log/apache2/devsforrentd.local-error_log"
        CustomLog "/private/var/log/apache2/devsforresnt.local-access_log" common

        <Directory "/Users/hudson/Sites/phalcon-skeleton">
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>
<VirtualHost *:80>
          DocumentRoot /Users/hudson/Sites/batistoni
          ServerName batistoni.local

          <Directory /Users/hudson/Sites/batistoni>
              AllowOverride All
              Require all granted
          </Directory>
  </VirtualHost>
<VirtualHost *:80>
          DocumentRoot /Users/hudson/Sites/devster
          ServerName devster.local

          <Directory /Users/hudson/Sites/devster>
              AllowOverride All
              Require all granted
          </Directory>
  </VirtualHost>

again , same root folder /Users/hudson/Sites/ but a lot of new projects within.

as for the computer hosts :

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

127.0.0.1 myphalcon.local
127.0.0.1 devsforrent.local
127.0.0.1 skeleton.local
127.0.0.1 batistoni.local
127.0.0.1 helloworld.local
127.0.0.1 ticia.local
127.0.0.1 batistoni.local
127.0.0.1 devster.local


103

i found it thanks