Laravel Redirect HTTP to HTTPS via .htaccess

twitter logo ・1 min read

Today, i share with you, redirect http to Https in laravel
You create file .htaccess in root laravel

RewriteEngine On
RewriteRule ^(.*)$ public/ [L]

Way code above it redirect to http, if you want http to https, you can using following code above

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

Post:Laravel Redirect HTTP to HTTPS via .htaccess

twitter logo DISCUSS (1)
Classic DEV Post from Jul 20

What Makes You a Great Programmer on The Team?

Majority of software developers are aspired to be not only a competent professional but also a great one.

AzDevXXI profile image
I is developer, I like Laravel, Nodejs, Angular, Vuejs