I'm trying to set up nginx vhost so I can use wordpress and laravel on the same domain. I put wordpress in the root folder And in a subfolder /laravel/ installed laravel
Is it possible to make that if for example laravel route /laravel-page in URL, request on server will not go to wordpress /index.php but to Laravel /laravel/public/index.php, and all other pages are normally requested to /index.php I would like to whitelist URLs using RegExp, which will be handled by Laravel.
UPDATE: After a few experiments, I managed to get what I wanted. I added:
location ~ ^/laravel-page(?:/(.*))?$ {
index /laravel/public/index.php;
}
These pages are now handled by Laravel: /laravel-page/1333/
. But for some reason, if I enter the address without the slash /laravel-page/1333
, it gives a 404 error, and not from wordpress or laravel, but the usual one from nginx. I tried adding a redirect:
rewrite ^/(.*)/$ /$1 permanent;
It works, but laravel doesn't open.