简体   繁体   中英

Too many redirects - htaccess

I'm trying to set up redirect from www to non-www and from http to https using htaccess, but I'm getting "too many redirects" error. My htaccess is:

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

and some headers (XSS, CSP...)

我的虚拟主机使用的是由于反向代理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM