Problem when forcing ssl in my domain with htaccess

1

this is my file that I have in Laravel 5

  

                 Options -MultiViews       

#redirect www to website root
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

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

When entering my domain.com I should redirect myself to link but it does give me an error ERR_TOO_MANY_REDIRECTS

    
asked by vdjkelly 25.03.2016 в 01:31
source

1 answer

2

This is the .htaccess that I use to force ssl in a Laravel project (Although laravel has nothing to do with redirects).

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
answered by 25.03.2016 / 04:27
source