I had an issue where I could not get the .htaccess of a PHP project I had to work.
I couldn’t understand why simple .htaccess code was not working.
After some wasted time, the obvious came to light, I was testing the project through scripts that started the built-in PHP server. Does the PHP server handle .htaccess files? A quick Bard AI request reveals the issue,
Does the in built PHP server handle .htaccess files?
No, the built-in PHP server does not handle .htaccess files. .htaccess files are specific to the Apache web server, and the built-in PHP server is not an Apache web server.
If you need to use .htaccess files, you will need to use a real web server, such as Apache or Nginx.
There are a few workarounds for using .htaccess files with the built-in PHP server. One workaround is to create a PHP script that parses the .htaccess file and handles all routing. Another workaround is to use a real web server to serve the .htaccess file, and then use the built-in PHP server to serve the rest of your website.
However, it is generally not recommended to use the built-in PHP server in production. It is intended for development and testing purposes only.
There you go. The built-in PHP server is not an Apache web server. “use a real web server, such as Apache or Nginx.” : )