apache - Can't find .htaccess loop error "Too many redirects" -


i can't figure out why when trying load webpage modified .htaccess file, browser returns me error "too many redirects".

can me find inside file mistake is?

options +followsymlinks rewriteengine on  rewritecond %{http_host} ^([www\.]*domain\.com)$ [nc] rewritecond %{request_uri} ^/.+$ [nc] rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301]  rewritecond %{http_host} ^([www\.]*domain\.com)$ [nc] rewritecond %{request_uri} ^/$ [nc] rewriterule ^(.*)$ https://www.domain.com/web [l,r=301] 

your error first rule:

rewritecond %{http_host} ^([www\.]*domain\.com)$ [nc] rewritecond %{request_uri} ^/.+$ [nc] rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] 

this saying:

  1. if host "www.domain.com" or "domain.com"
  2. and request isn't "/"
  3. then redirect same host , request using "https" scheme

so no matter request go to, end in loop because of rule.

let's say, go http://domain.com/:

  1. the host "domain.com" , uri "/"
  2. the second rule redirects browser https://domain.com/web
  3. the browser loads new url
  4. the host "domain.com" , uri "/web"
  5. the first rule redirects browser https://domain.com/web
  6. repeat starting step 3

thus have redirect loop.

i have no idea you're attempting rule, 1 thing , 1 thing cause permanent redirect loop.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -