Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

leonidas's avatar

Laravel Valet Wordpress redirect

I am trying to set up Valet for Wordpress development and have successfully linked the directory so the Wordpress site loads to http://wp.test.

The issue I am having is that whenever I go to a sub page, eg.

http://wp.test/test

the REST-api

http://wp.test/wp-json

or a page that doesn't exist,

http://wp.test/test

it only displays the main page, not the json response or the 404 as seen on other, standard nginx installations I have on other machines. It doesn't redirect as such, only displays the (incorrect) home page.

0 likes
6 replies
arifkhn46's avatar

I installed Wordpress and everything is just working fine, I am not facing any problem.

junipear's avatar

@leonidas did you resolve this issue? I have saving pretty permalinks, but other than that, I am at a loss.

Edits: I changed permalinks to be as post name, then refreshed. The first time I did this, it did not stick. It is now resolving json objects.

leonidas's avatar

@junipear Unfortunately I only got it to work with standard nginx. I did like valet as it abstracted this away for Laravel, but I couldn’t get it to work as expected for Wordpress.

I ended up porting the project to Django As I couldn’t get this to work properly, and I could start from scratch.

Stay safe.

Leon

nickbasham's avatar

@leonidas I'm having the same issue and it's driving me nuts…I'm trying to build out a 404 template, but I can't view it because any URL that should return the 404 template immediately redirects to the homepage. I started digging in the Valet composer files and see if a custom driver would do it, but I'm at a loss for how to fix this.

leonidas's avatar

@nickbasham i couldn’t get this to work in the end either it was a shame as it is would be a good alternative to mamp that I usually use for Wordpress projects

Please or to participate in this conversation.