如何解决重定向 CSS 过多
我得到错误 style.css:1 GET https://www.example.com/cs_CZ net::ERR_TOO_MANY_REDIRECTS
可能与我的 htaccess 有关吗?
RewriteEngine On
AddDefaultCharset utf-8
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.PHP [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.PHP [NC,L]
编辑: @ravinderSingh13 更改后,我的权限出错
解决方法
以下列方式获取您的 htaccess 文件,请确保在测试您的 URL 之前清除浏览器缓存。
RewriteEngine On
AddDefaultCharset utf-8
##Placing rules for non-https URLs here to apply https on URLs.
##Fixes: Added NE flag in rules here.
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
##Placing rules for non www URLs here to apply www on URLs.
##Fixes: Added NE flag in rules here.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}/$1 [R=301,L,NE]
##Rules for files to block those urls.
##Fixes: Added L flag to the rules.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [F,L]
RewriteRule ^\.htaccess/?$ - [F]
##Removed condition RewriteCond %{REQUEST_URI} ="" here as its not required.
RewriteRule ^/?$ /public/index.php [L]
##Rules for non public uris to handle here.
RewriteCond %{REQUEST_URI} !^/public [NC]
RewriteRule ^(.*)/?$ /public/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(public)/.*$ /$1/index.php [QSA,NC,L]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。