0

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!

Community
  • 1
  • 1
  • A bit late, but fortunately I found an answer myself, following the information from the first link i wrote. I added: `code`Route::filter('before', function() { if (!Request::secure()) return Redirect::to_secure( URI::current()); }); – Enric Piferrer Torres Sep 02 '15 at 15:32

1 Answers1

0

you need to add

Route::any(....., array(
    ...
    "https"=> true
    ....
    function(){ ... }
));
serdar.sanri
  • 2,217
  • 1
  • 17
  • 21