Is it possible to detect and redirect ALL HTTPS requests to HTTP in LARAVEL(coding) level? I am asking because I haven't came across any questions like this, they were all asking to redirect from HTTP to HTTPS.
Thanks in advance!
You can use simple middleware for that.
<?php
namespace App\Http\Middleware;
use Closure;
class Nonsec
{
public function handle($request, Closure $next)
{
if($request->secure()) {
return redirect($request->path());
}
return $next($request);
}
}
Add it in a list of web
array at middlewareGroups
. File app/Http/Kernel.php
Just simple, to add your https link in your link.
For example will be looks like this
APP_ENV=production
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_KEY=base64:R4pkmCx5jr21J3EgsvYttiJdBsnIpC3rli0fCfxcd0c=
APP_URL=https://linkkamu.com/
i hope i will help your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.