Apache / PHP built in server

using apache vs using php built in server when dealing with URL params and routes is a bit confusing.

How do I make each folder inside the htdocs acts like php built in server so each folder would be the document root

You need to create virtual hosts.

It does change the document root but it won’t handle url params the same way

so I have in index.php echo $_SERVER["REQUEST_URI"];

If I go to localhost:3001/home It would print home using php built in server

but with xampp It would just give 404 if I add any parameter to the url

If you are going to localhost anything, you didnt set up virtual hosts.

I would suggest you use Laragon. It is much better than XAMMP and creates virtual hosts automatically. You would just go to https://yourapp.test

1 Like

yes I changed the hosts in the host file so I am going to landingpage/

gonna check that laragon

image

It does not achieve it but I like largon, thank you for telling me about it

Edit: nginx does the job

image

Sponsor our Newsletter | Privacy Policy | Terms of Service