mardi 23 juillet 2019

Force all Local links in Laravel to open in HTTPS

I never coded in Laravel and one of my clients has a website built with Laravel that he recently switched to HTTPS.

The site open but all the images/videos/files open in HTTP and not HTTPS.

They use this format: /img/image.png instead of a full URL.

Any idea how to make it so that every single link/image/video opens in HTTPS?

The below is my htaccess file:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>


RewriteEngine On

    #force https
    RewriteCond %{HTTP:X-Forwarded-Proto} =http
    RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]


    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

The website opens in HTTPS but some assets don't.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire