Search code examples
apachezend-framework2mampvhosts

Zend Framework 2, vhosts and MAMP


I think I've configured all files properly, but when I access the url: myapp.local, it points to the MAMP/htdocs/ directory instead of /MAMP/htdocs/ZendSkeletonApplication-master/public/ (going to this public directory displays correctly de zf2 example webpage), here is my configuration:

httpd-vhosts.conf

<VirtualHost *:8888>
    ServerName myapp.local
    DocumentRoot "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/"
    <Directory "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

hosts

127.0.0.1 myapp.local

Can someone tell me what I'm doing wrong? I want my base url to point at the /Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/ directory, not at htdocs.

Similar question here, but I can't get the answer. Vhost Zend Framework configuration MAMP - redirected to the index page of the server

Thanks


Solution

  • Just try this in the httpd.conf file (where you must have enabled to include the httpd-vhosts.conf file) -

    <VirtualHost myapp.local>
        DocumentRoot "/Applications/MAMP/htdocs/ZendSkeletonApplication-master/public/"
    </VirtualHost>
    

    There should be no need to enable the httpd-vhosts.conf file.