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:
- if host "www.domain.com" or "domain.com"
- and request isn't "/"
- 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/
:
- the host "domain.com" , uri "/"
- the second rule redirects browser
https://domain.com/web
- the browser loads new url
- the host "domain.com" , uri "/web"
- the first rule redirects browser
https://domain.com/web
- 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
Post a Comment