Categories: How ToServers

How to Change URL from HTTP to HTTPS on Laravel

Based on Solving my problem! Since the proxy uses HTTPS and Laravel uses HTTP Request as default you may try to configure it to HTTPS.

Like this

config/app.php

'url' => env('APP_URL', 'https://www.mydomain.com/'),
'asset_url' => env('ASSET_URL', 'https://www.mydomain.com/'),

.env

APP_NAME=XX
APP_ENV=XXX
APP_KEY=base64:XXX
APP_DEBUG=true
APP_URL=https://www.mydomain.com/

app/Providers/AppServiceProvider.php

public function boot()
{
    if (env('APP_ENV') !== 'local') {
        $this->app['request']->server->set('HTTPS', true);
    }
}

routes/web.php

At the beginning of codes add this;

URL::forceRootUrl('https://www.mydomain.com/');

After doing this, your CSS/JS will be loaded as HTTPS not HTTP anymore.

ferisetyawanmyid

Recent Posts

Best SSH Clients for Linux: Top Tools for Secure Remote Connections

If you manage Linux servers regularly, you know how important SSH (Secure Shell) is. Whether…

6 days ago

🐧 Best Linux Distributions for Beginners and Daily Use (2025 Edition)

If you’re new to Linux or thinking about switching from Windows or macOS, this guide…

1 week ago

Essential SRE Tools That Run on Linux

Introduction Site Reliability Engineering (SRE) has become a critical discipline in modern IT operations. The…

4 weeks ago

Best Free CRM Websites for Businesses in 2025

Updated: August 17, 2025 A practical guide to the best free CRM (Customer Relationship Management)…

1 month ago

Free Website Hosting Control Panel for Linux

If you run a VPS or dedicated server with Linux, you probably know that managing…

2 months ago

How to Find Out Who Rebooted Your Ubuntu Server (Step-by-Step Guide)

Short summary: Use built-in Linux tools (`who`, `last`, `journalctl`, `/var/log/auth.log`) and optional audit logs to…

2 months ago

This website uses cookies.