Replace localhost with real domain name in reset password of Laravel 5

Devith picture Devith · Jul 3, 2017 · Viewed 8k times · Source

I am using the default resetting passwords in Laravel 5.4. The function works fine, and the email with reset password link is successfully sent/received.

However, it still not show the real domain but 'localhost' like something below:

http://localhost/password/reset/4c16a78f3c1216de566bc0689694980ac53555311d0214bbb73fbc72870a91f5

Can you tell me how to replace 'localhost' with domainname.com?

And is it OK to do this with http:// instead of https:// ?

Answer

manniL picture manniL · Jul 3, 2017

Change the APP_URL parameter in your .env file to adapt the app's domain name.

APP_URL=http://localhost to APP_URL=https://yourdomain.com

If you cache your config (which you shouldn't do in local or test environment but definitely in production), don't forget to use the php artisan config:clear command.