在URL中强制http到Laravel中的https重定向(不带“www”)

I am beginner in Laravel. I use in my project Laravel 5.8. This is my htacess:

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

    RewriteEngine On

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

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

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

How can I make redirect from http://name.com, http://www.name.com, https://www.name.com to https://name.com?

It's posible in htacess or Middleware?

You can use this in your .htaccess

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Here is .htaccess snippet for force redirect HTTP to https

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / Options +SymLinksIfOwnerMatch ​ RewriteCond %{HTTPS} =on RewriteRule ^ - [env=proto:https] ​ RewriteCond %{HTTPS} !=on RewriteRule ^ - [env=proto:http] ​ RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC] RewriteCond %{SCRIPT_FILENAME} -d [OR] RewriteCond %{SCRIPT_FILENAME} -f RewriteRule "(^|/)\." - [F] ​ RewriteCond %{HTTP_HOST} ^domainname\.com$ [NC] RewriteRule ^(.*)$ http://domainname.com$1 [R=301,L] ​ RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://domainname.com/$1 [R,L] ​ ​ ​ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] ​ </IfModule>