0

Somehow my virtualhosts won't work and give me The requested URL / was not found on this server. I have tried multiple things, but can't get it to work. My MAMP root folder is set to the Projects folder

I have the following folder structure:

-Projects
   -website1
   -websites
      -public
      -system
         -website2

What I want is website1 to work on a different URL than website 2. What I have:

<VirtualHost *:8888>
    VirtualDocumentRoot "/Users/myname/Documents/Projects/websites/system/%-3"
    ServerAlias *.system.test
</VirtualHost>

<VirtualHost *:8888>
    VirtualDocumentRoot "/Users/myname/Documents/Projects/websites/public/%-3"
    ServerAlias *.public.test
</VirtualHost>

<VirtualHost *:8888>
    VirtualDocumentRoot "/Users/myname/Documents/Projects/website1"
    ServerAlias test.nl
</VirtualHost>

the hosts file:

127.0.0.1    website2.system.test
127.0.0.1    test.nl

I have also tried:

<VirtualHost *:8888>
        VirtualDocumentRoot "/Users/myname/Documents/Projects/%-3"
        ServerAlias *.test.nl
    </VirtualHost>

Nothing seems to work to get website1 (wordpress website) working under test.nl any ideas? The reason why I have that folder structure is because "websites" is for work and the root for private projects. BTW whenever I put website1 in the system folder and add : website1.public.test to the hosts file it works, however when I put it in the public folder it doesnt, it looks like the only virtualhost read is the top one?

1
  • You need ServerName directives in your vhost config sections.
    – Zimmi
    Jul 25, 2015 at 16:55

1 Answer 1

0

I finally found a fix: Apache 2 only serves first virtual host

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.