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

ITwrx's avatar
Level 1

route helper uses "http://localhost" in email views

i have {{ route('view/issue', $issue->id) }} in an email view. This generates "http://localhost/issues/625/view-issue" instead of "https://superdomain.com/issues/625/view-issue". Routes in the rest of the application work fine.

I have 'url' => env('APP_URL', 'https://superdomain.com'), in my config/app.php and i even set URL::forceRootUrl('https://superdomain.com'); in my AppServiceProvider.php to try and force it to work.

i can dump config('app.url') or env('APP_URL') and they both give me "https://superdomain.com" but the urls in the email still use "http://localhost". I also have my .env set with APP_URL=https://superdomain.com and there are no other .env files in the root dir.

Anything else i need to check?

Thanks in advance!

I'm using laravel 6.18.3 and php 7.3.11

0 likes
5 replies
ITwrx's avatar
Level 1

i had done php artisan config:clear but now i ran your command and dumping env('APP_URL') from the controller gives me "null" instead of "https://superdomain.com" and makes me wonder if i had forgotten to dump the env variable earlier. i know i dumped the config variable.

i wonder what could cause my env variable to return null. i checked the file perms and that is good. The whole app works except for this strange issue.

thanks

ITwrx's avatar
Level 1

well, i was trying to dump env('APP_URL') using a variable named $env... now dumping with $url = env('APP_URL'); returns the domain, but url is still not created properly in email. very annoying.

ITwrx's avatar
Level 1

thanks. that's good to know.

Please or to participate in this conversation.