繁体   English   中英

ERR_TOO_MANY_REDIRECTS错误的解决方案

[英]Solution to ERR_TOO_MANY_REDIRECTS error

我已经彻底搜索了stackoverflow,但找不到我收到的此错误的任何解决方案。

信息:

  1. 我仅在.htaccess使用重定向,并且我的网页中没有活动的html重定向。
  2. 我正在使用.htaccessdefault.php重定向到root ,将non-www重定向到wwwerror page 404.phpcache controlgzip文件。 (我的htaccess的内容在下面给出)。

错误:

  1. 我输入了错误的网址来测试404 redirect并收到显示ERR_TOO_MANY_REDIRECTS 我尝试清除浏览器缓存,还研究了stackoverflow以调试htaccess代码,但htaccess还没有解决方案。

需要帮助:

  1. 我将要求s​​tackoverflow成员帮助我解决此错误,以供参考,我在下面发布了我的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.

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