lasse's avatar
Level 9

Subdomains with Laravel Valet

How do I get subdomains to work with Laravel Valet.

When I do subdomain.domain.dev all I get is:

"404 - Not Found"

Is it possible at all or is it one of the limitations of Valet vs. Homestead?

0 likes
4 replies
noeldiaz's avatar
noeldiaz
Best Answer
Level 23

@barbarouspony On another thread this was asked and I suggested an idea that I believe worked for the person that was asking. Since Valet relies on directories to resolve the domains, I suggested that the person create a symbolic link to the directory with their installation, and that they name this linked directory the subdomain they wanted. So like if you application is in "domain" directory make a symlink and name it "subdomain.domain" with something like:

ln -s domain subdomain.domain

That will make valet find your subdomain. Supposedly this worked for the user that needed it. Now, since the latests versions of Valet use Caddy server, maybe they will be able to find a way to make this simpler? I think it provides more flexibility. But for now this seems to work.

5 likes
lasse's avatar
Level 9

Struck gold!

ln -s domain subdomain.domain

Did the trick. Run the command from the same level as the domain folder, and it's all there is.

Thanks!

1 like
packy's avatar

There is also this command:

valet link subdomain.project

1 like

Please or to participate in this conversation.