7 months ago

Laravel 6+ Force redirections from http to https

Posted 7 months ago by Seeker1337

Hey there, I've recently uploaded my website to a VPS ( ubuntu 18.04 with webmin/virtualmin/lamp ) and added a Comodo SSL. However, when I try to access my website through http:// connection I get redirected to a blank page that's currently displaying the following text " Index of / " and below it " Name, Last modified, Size, Description". It's all blank it doesn't show any data.

The bad part is when I type my website's name in the tab and hit enter I get redirected to this http connection. My website's HTTPS connections are all set and running properly.

EDIT: It's also weird that when I get redirected to that blank page and hit Enter in the URL tab section I get redirected through the HTTPS connection. Its like if I type it twice I then get a proper connection. Here is my .htaccess file:

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

        RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} ^my-domain\.com [NC]
    RewriteCond %{SERVER_PORT} 443 
    RewriteRule ^(.*)$ [R=301,L]

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

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

Here is my .env file:

APP_NAME=not important
APP_KEY=not important


Please sign in or create an account to participate in this conversation.