php - .htaccess http to https redirect loop issue -


i trying redirect users https://example.com when enter http://example.com in browser. using .htaceess acheive redirection. problem after adding below .htaccess site, browser(chrome) shows this webpage has redirect loop . .htaccess file

<ifmodule mod_rewrite.c>  rewriteengine on  rewritecond %{https} off  rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301]  rewritecond %{http_host} !^www\.  rewriterule ^(.*)$ https://www.%{http_host}%{request_uri} [l,r=301] </ifmodule> 

please suggest me solution

user below code :

rewriteengine on rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -