【发布时间】:2014-08-19 20:31:23
【问题描述】:
我已经彻底搜索了 stackoverflow,但找不到任何解决我收到的此错误的方法。
信息:
- 我仅在
.htaccess中使用重定向,并且我的网页中没有有效的 html 重定向。 - 我正在使用
.htaccess将default.php重定向到root、non-www到www、error page 404.php、cache control和gzip文件。 (我的 htaccess 内容如下)。
错误:
- 我输入了错误的 URL 来测试
404 redirect并收到了显示ERR_TOO_MANY_REDIRECTS。我尝试清除浏览器缓存,还研究了 stackoverflow 以调试我的htaccess代码,但目前还没有解决方案。
需要帮助:
- 我会请求 stackoverflow 成员帮助我解决这个错误,作为参考,我在下面发布了我的 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>
让我知道我哪里出错了,以及是否需要任何其他细节来解决这个错误。
【问题讨论】:
标签: php regex .htaccess mod-rewrite redirect