.htaccess causing "Excess Redirection"

0

I have the following .htaccess:

    RewriteEngine on

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule (.*) https://www.%1/$1 [NE,L,R]

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [L,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ /$1.html [L]

The intent is to force HTTPS and remove the .html from my site URL, but every time I enter that .htaccess it causes the following error when trying to access the site :

Just go back with my other .htacces to solve the problem, I do not use this one because it only forces HTTPS but does not remove the .html from the URL.

.htacces working

RewriteEngine on
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R] 
  • What could be causing this?

  • Any problems with the server or my first .htaccess is wrong?

  • Is there another way to force HTTPS and remove the .html from the URL?

asked by anonymous 04.12.2017 / 13:39

0 answers