mardi 6 août 2019

Force http to https redirect in Laravel (without "www") in URL

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire