DanielRønfeldt's avatar

Herd won't find a non-Laravel site

Considering that Herd is just a wrapper around Valet, I thought I'd just create a new folder under the same folder where Herd is looking for Laravel sites, and Herd would allow me to launch it by using the folder's name (in my case it's dwd) followed by .test local domain, i.e. http://dwd.test.

I created a simple index.php file and placed it within the dwd folder just to make sure my setup works.

However, when opening the said URL in the browser, Herd is throwing a 404 Site Not Found exception. Any ideas on how could I make this work?

0 likes
3 replies
LaryAI's avatar
Level 58

To resolve the issue of Herd not finding your non-Laravel site, you need to ensure that Herd (and by extension, Valet) is properly configured to recognize and serve your new directory. Here are the steps you can follow to troubleshoot and fix the issue:

  1. Ensure Herd is Running: Make sure that Herd is running. You can start Herd by running:

    herd start
    
  2. Link the Directory: You need to link your new directory to Valet. Navigate to the parent directory where your dwd folder is located and run:

    cd /path/to/parent-directory
    valet link dwd
    

    This command will create a symbolic link in Valet's configuration, pointing to your dwd directory.

  3. Check the Directory Structure: Ensure that your dwd directory has an index.php file. The structure should look something like this:

    /path/to/parent-directory
    └── dwd
        └── index.php
    
  4. Verify Valet Configuration: Make sure that Valet is configured to serve the directory. You can check the linked directories by running:

    valet links
    

    You should see an entry for dwd.

  5. Restart Valet: Sometimes, restarting Valet can resolve issues. Run:

    valet restart
    
  6. Check for Conflicts: Ensure there are no conflicting configurations or other services running on port 80 that might interfere with Valet.

  7. Access the Site: Open your browser and navigate to http://dwd.test. If everything is set up correctly, you should see the output of your index.php file.

Here is a simple index.php file for testing:

<?php
echo "Hello, Herd!";

By following these steps, you should be able to get Herd to recognize and serve your non-Laravel site. If you still encounter issues, you might want to check the Herd and Valet logs for any error messages that could provide more insight into the problem.

DanielRønfeldt's avatar

It appears that Herd somehow doesn't "like" when there are folders along with the index.php file inside the main dwd folder. As soon as I remove those folders, Herd will happily run my index.php file.

Basically, I'm trying to build a crude MVC framework from scratch, as a fun side project. Its structure (that Herd doesn't like) is as follows:

dwd/
├── app/
│   ├── controllers/
│   ├── models/
│   ├── views/
├── public/
│   ├── css/
│   ├── js/
│   └── index.php
├── config/
│   └── config.php
├── core/
│   ├── Controller.php
│   ├── Model.php
│   └── App.php
├── .htaccess
└── composer.json

Is there any way to make it work with my folder/file structure?

DanielRønfeldt's avatar

I just found out what bothered our friend Herd :) It's the public folder, or rather its name. As long as I rename it into anything else, for instance build, Herd will happily oblige and not showing the 404 Not Found page anymore.

Now if only I knew the reason as to why Herd doesn't like my folder's name... :)

Please or to participate in this conversation.