[英]Solution to ERR_TOO_MANY_REDIRECTS error
我已经彻底搜索了stackoverflow,但找不到我收到的此错误的任何解决方案。
信息:
.htaccess
使用重定向,并且我的网页中没有活动的html重定向。 .htaccess
将default.php
重定向到root
,将non-www
重定向到www
, error page 404.php
, cache control
和gzip
文件。 (我的htaccess的内容在下面给出)。 错误:
404 redirect
并收到显示ERR_TOO_MANY_REDIRECTS
。 我尝试清除浏览器缓存,还研究了stackoverflow以调试htaccess
代码,但htaccess
还没有解决方案。 需要帮助:
.htaccess中:
<Ifmodule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
### re-direct default.php to root / ###
RewriteCond %{THE_REQUEST} ^.*\/default\.php\ HTTP/
RewriteRule ^(.*)default\.php$ /$1 [R=301,L]
### re-direct non-www to www of main domain
RewriteCond %{http_host} ^bookkeralatourpackage\.in$ [nc]
RewriteRule ^(.*)$ http://www.bookkeralatourpackage.in/$1 [r=301,nc,L]
#### Rule for Error Page - 404 ####
ErrorDocument 404 http://bookkeralatourpackage.in/404.php
</Ifmodule>
<ifModule mod_headers.c>
Header set Connection keep-alive
ExpiresActive On
# Expires after 1 month
<filesMatch ".(gif|png|jpg|jpeg|ico|pdf|js|htm|html|txt)$">
Header set Cache-Control "max-age=2592000"
</filesMatch>
# Expires after 1 day
<filesMatch ".(css)$">
Header set Cache-Control "max-age=86400"
</filesMatch>
</ifModule>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
让我知道我哪里出了问题,以及是否需要其他任何细节来解决此错误。
最明显的问题是错误文件没有www
。 这意味着在重定向到http://bookkeralatourpackage.in/404.php
,必须应用www
重定向。 更改为:
ErrorDocument 404 http://www.bookkeralatourpackage.in/404.php
下一个可能的问题是如果404.php
文件不存在:您将输入重定向链。 因此,请检查http://www.bookkeralatourpackage.in/404.php
存在。
我不确定是否需要RewriteCond %{THE_REQUEST} ^.*\\/default\\.php\\ HTTP/
行。 没有该规则可能会起作用。
如果有任何效果,请告诉我们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.