Search code examples
apachemamp

MAMP - Document root wont work properly


MAMP - Document root won't work properly It only display one of my other projects, even If I change the root directory to my current project it just displays the same project as before. I can't change it at all no matter what I do, I have reinstalled MAMP 4 and MAMP 3. No matter what I do there is the same problem? CAN ANYONE HELP!!


Solution

  • This not DocumentRoot issue it's Directory issue because of MAMP use Apache 2.2.32. Apache2.2 and Apache2.4 are different Vhost format. MAMP version history.

    Apache 2.2 Vhost format:

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
        ServerName dummy-host2.example.com
        ErrorLog "logs/dummy-host2.example.com-error_log"
        CustomLog "logs/dummy-host2.example.com-access_log" common
    </VirtualHost>
    

    Apache 2.4 Vhost format:

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
        ServerName dummy-host2.example.com
        <Directory "/Applications/MAMP/Library/docs/dummy-host2.example.com">
            Options -Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog "logs/dummy-host2.example.com-error_log"
        CustomLog "logs/dummy-host2.example.com-access_log" common
    </VirtualHost>
    

    Apache Vhost format reference.

    If you use MAMP your issue will not solve. Try Apache 2.4. If you are Windows user then use XAMPP or WAMP. If you are Mac user then use XAMPP.