Join WhatsApp ChannelJoin Now

laravel 8 Http to Https Using .htaccess Example

Hi Dev,

Today, i we will show you laravel 8 http to https using .htaccess example. This article will give you simple example of laravel 8 http to https using .htaccess example. you will learn laravel 8 http to https using .htaccess example. So let’s follow few step to create example of laravel 8 http to https using .htaccess example.

Add following code in bottom of .htaccess file.

# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  
# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Recommended Posts