How to set php artisan serve with custom domain in Laravel on Windows

Last updated at April 25, 2021


php artisan serve command runs your website with ip and 8000 port by default.

How can we serve with custom domain like zemna.test for development?

Before starrt

You can use any name of domain only for your computer. But the best practice is use .local or .test domain.

In past, .dev domain also be used many times.

But .dev domain will be automatically redirect to https protocol by browser.

So, use .local or .test domain.

Add custom domain mapping in Windows hosts file

Open C:\Windows\System32\drivers\etc file, and add a new line

C:\Windows\System32\drivers\etc zemna.test

Upate app url in .env file

Update APP_URL in your .env file


Run php artisan serve command with custom domain

php artisan serve --host=zemna.test --port=80

Access your web application using custom domain

You can access your web application with custom domain.