This package only does one thing: Force a connection through https! If a user visit the site with an unsecure "http"-Request (example: http://example.com) he will be automatically redirected to a secure route (example: https://example.com)
- In order to install the package, just run the following command in the root directory of your laravel installation:
composer require jkniest/force-https
- If you are using Laravel 5.4 oder below, open the
config/app.php
file and add the following code to theproviders
array:
jkniest\ForceHttps\ForceHttpsServiceProvider::class,
- Run the command below to copy the configuration files to your
config
folder
php artisan vendor:publish --tag="force-https"
- Add the following line to the
.env
file
FORCE_HTTPS=true
- Open the
app/Http/Kernel.php
file and add the following code to themiddleware
array:
\jkniest\ForceHttps\ForceHttps::class,
To disable the https-redirection (for example on staging servers) just change the FORCE_HTTPS=true
in your .env
file to FORCE_HTTPS=false
The ForceHttps package is open-sourced software licensed under the MIT license.