So I'm using the built-in PHP server for local development and testing:<p><pre><code> php -S localhost:8080
</code></pre>
One major eccentricity or "bug" of this built-in server is that it not only treats index.php as the default page but also "rewrites" any URL paths to that page. That means when I type `http://localhost:8080/foo/bar`, it shouldn't open anything as there is no `/foo/bar` directory structure. Instead, it causes the /foo/bar to be rewritten to my index.php so that the URL actually becomes `http://localhost:8080/index.php/foo/bar`.<p>On a production server, this won't happen unless you add an apache rule in the .htaccess file. So this creates obvious problems sometimes for reproducing a live issue as local testing goes smoothly whereas the app won't work on production. Is there a way to make the built-in server stop redirecting every request to index.php and behave just like apache or nginx server?
1) If I understood your question correctly, you might want to use a router script for such cases: <a href="https://www.php.net/manual/en/features.commandline.webserver.php" rel="nofollow">https://www.php.net/manual/en/features.commandline.webserver...</a> (see Example #3).<p>2) For the love of god, don’t use built-in server for production cases. It’s mentioned multiple times in the documentation for a reason.