Problem when forcing ssl in my domain with htaccess


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 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

1 answer


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