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

shadkamel's avatar

how to enable APP_URL in windows ?

hello friends, i see in many videos that the laravel application url is set to http://example.test , i try to access this url but it is not available. and it is defined in my .env

here is the .env file:

APP_NAME=example
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://example.test

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=example
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
0 likes
15 replies
vincent15000's avatar

That's only an example. You have to change the APP_URL value in the .env file according to your environment.

In development, I never changed it because I'm using the PHP dev server.

In production, you should change the value and set it to the domain name of your website.

Are you using Laragon ?

1 like
shadkamel's avatar

@vincent15000 thanks for your replay, but i mean for development not for production, and that example is just an example that i set, in my real project it is another thing.

1 like
newbie360's avatar

@shadkamel actually you can keep this line by default in .env

APP_URL=http://localhost

but you need change hosts file, the path in Windows is

C:\Windows\System32\drivers\etc\hosts

in the hosts file add (require Admin)

127.0.0.1	your-project.test
2 likes
newbie360's avatar

@shadkamel i don't know about Mac OS, but in Windows / Linux, we need add it in the hosts file, otherwise the OS will find the domain via DNS

1 like
Shivamyadav's avatar

tell me the name which server you use xammp or laragon

1 like
newbie360's avatar

@shadkamel if there is a web server already running, you shouldn't run php artisan serve

2 likes

Please or to participate in this conversation.