Serve an external PHP system through a sub directory of a Netlify Next.js website


We have a main website running using Next js on Netlify ( and we have a PHP (Laravel) service running on a sub domain (

Ideally we would like to run it on Is there anything in Netlify than can manage this for us?

Hey @snips11

Check out the Proxy to another service section of the Rewrites and Proxies documentation which shows how to achieve exactly what you are wishing to do :slight_smile:

Thanks for your help @colemay

I have added the following to the redirects in the netlify.toml file

  from = "/members-directory/*"
  to = "  200"
  status = 200
  force = true

But it is still getting a 404 when I go to

Could I be missing something?

This line is incorrect

Should read

to = ""

Thank you so much, thats great. Nearly all working, just one last question…

  from = "/members-directory"
  to = ""
  status = 200
  force = true

When using the above the route works perfectly but the url removes the /members-directory so makes it look like its loaded in the root. Is there a way of getting the correct content but maintaining the /members-directory? I guess you could always reflect that in the Laravel application and then again over here in the from but is there an easier way?

This is strange behaviour. I am thinking this is something to do with Next.js. as it is not a known internal route. My knowledge of Next.js is limited so I do not know if there is a way to stop it.

An alternate method (perhaps) it to integrate the directory directly into the main site, fetching data from rather than displaying it as a site.