Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ngoquocdat's avatar

.htaccess not working on macos big sur

Hello everyone, Currently I am having a problem, that is .htaccess is not working in my php project. I run the web server using php -S localhost:8000

But when I run the laravel application .htaccess works

Help me how to fix .htaccess working.

Thanks very much

0 likes
3 replies
tykus's avatar

PHP's built-in server does not read Apache config.

You can define a "router script" for the PHP server to act similarly to htaccess rules; more here

If a PHP file is given on the command line when the web server is started it is treated as a "router" script. The script is run at the start of each HTTP request.

https://www.php.net/manual/en/features.commandline.webserver.php

tykus's avatar

How does what work;.htaccess? That works whenever you are using Apache to serve you web application.

1 like

Please or to participate in this conversation.