Redirects to HTTPS on Laravel 3

140 Views Asked by At

I set a SSL certificate in my website, currently using Laravel 3. I am trying to get redirects from HTTP to HTTPS, so when a user enter our former website address, it automatically redirects to the new https site. However, I was unable to achieve it by now.

I found a related topic: Laravel 3 HTTP and HTTPS routes

but it does not work for me.

Alternatively, I tried what was said in this other topic: How to redirect all HTTP requests to HTTPS

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

and I got the same result, not working.

Does anyone have a solution for Laravel 3?

Thank you!

1

There are 1 best solutions below

0
serdar.sanri On

you need to add

Route::any(....., array(
    ...
    "https"=> true
    ....
    function(){ ... }
));