I need to redirect *.htm *,htm *,html to *.html, but when page is *.html leave same URL *.html.
I have this rule, but there's problem -> redirect loop. What should I change?
RewriteEngine On
RewriteRule ^(.*)(\.|,)htm(l?)$ $1.html [R=301]
CodePudding user response:
As CBroe rightly commented that issue is with your pattern that also matches .html hence will cause a redirect loop.
You can fix it by using:
RewriteRule ^(. )(?:\.htm|,html?)$ $1.html [R=301,L,NC,NE]
PS: This assumes RewriteBase directive has been used before.
