support@codebucket.net

How to use HTTPS for all routes in Laravel

How to use HTTPS for all routes in Laravel

K. M. Shawkat Zamil | September 21, 2022

Hello Developers,

The tutorial will demonstrate to you to use HTTPS in all routes of the Laravel Project. For that, I will show you to use the .htaccess file configuration. Using the following lines in your .htaccess file automatically redirects you to the HTTPS version of your site.

 

Add two line in .htaccess

 

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

Now browse any route of your project. Hope this might help you in your development journey.

 

Read More: How to excel import with date format in Laravel

 

K. M. Shawkat Zamil

K. M. Shawkat Zamil

Senior Software Engineer

I am a Senior Software Engineer in a reputed company in Bangladesh. I am a big fan of Laravel, PHP Programming, MSSQL Server, MySql, JavaScript, and lots more. I love to help people who are especially eager to learn. I believe in patience and motivation.