Skip to content
Advertisement

Preventing http access in Laravel 8

I have a question about force using HTTPS in laravel, i’ve added a condition inside AppServiceProvider.php, creating a middleware and modifying the .htaccess file. But I can still access the http page. Is there any other way to get laravel to redirect to https instead of http, and how to prevent user to acces the http addres? thank you!

my .htaccess :

JavaScript

AppServiceProvider.php :

JavaScript

HttpsProtocolMiddleware :

JavaScript

Advertisement

Answer

add this at the top of your .htaccess file

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement