Download the PHP package yaroslawww/laravel-force-https without Composer
On this page you can find all versions of the php package yaroslawww/laravel-force-https. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yaroslawww/laravel-force-https
More information about yaroslawww/laravel-force-https
Files in yaroslawww/laravel-force-https
Package laravel-force-https
Short Description Easy redirect to https for Laravel.
License MIT
Homepage https://github.com/yaroslawww/laravel-force-https
Informations about the package laravel-force-https
Laravel Force Https
An easy redirect to https for Laravel.
Redirects using server config
The fastest and easiest way to do a redirect is to configure the server to redirect requests itself (an example is shown below). But in some situations you may not have access to the configuration, or you need to do additional checks using PHP. Then this package comes in handy.
Redirect using apache2
Add to .htaccess
Redirect using nginx
You need to migrate configurations from port 80 to 443 and then add redirect from port 80 to port 443
Table of Contents
- Installation
- Composer
- Usage
- Middleware
- Config
- Config files
- Service providers
- Changelog
- License
Compatibility
For use php < 8.0 please use version "^2.0"
Installation
Usage
Middleware
Moreover, this package includes a middleware object to redirect all "non-ssl" routes to the corresponding "ssl".
So, if a user navigates to http://url-to-laravel/test and the system has this middleware active it would redirect (301) him automatically to https://url-to-laravel/test. This is mainly used to avoid duplicate content and improve SEO performance.
To do so, you have to register the middleware in the app/Http/Kernel.php
file like this:
Config
Config Files
In order to edit the default configuration for this package you may execute:
After that, config/force-https.php
will be created. Inside this file you will find all the fields that can be
edited in this package.
Since you will typically need to overwrite the assets every time the package is updated, you may use the --force flag:
Changelog
View changelog here -> changelog