【问题标题】:redirect loop error on datalife enginedatalife引擎上的重定向循环错误
【发布时间】:2013-11-14 01:24:09
【问题描述】:

我的 datalife 引擎帖子网址有问题。在我的一些帖子中,我在 Firefox 和其他浏览器上收到“页面未正确重定向”。看来这个问题是由 htaccess 属性引起的。

# Full news
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6&seourl=$6 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5&seourl=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$ engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5&seourl=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4 [L]

RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$4&news_page=$2&cstart=$3&seourl=$5&seocat=$1 [L]
RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$2&seourl=$4&seocat=$1 [L]
RewriteRule ^([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$2&newsid=$3&seourl=$4&seocat=$1 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2&seourl=$3&seocat=$1 [L]

RewriteRule ^page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$1&cstart=$2&seourl=$4 [L]
RewriteRule ^page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2&news_page=$1&seourl=$3 [L]
RewriteRule ^print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$1&newsid=$2&seourl=$3 [L]
RewriteRule ^([0-9]+)-(.*).html(/?)+$ index.php?newsid=$1&seourl=$2 [L]

我可以做些什么来解决这个问题?

【问题讨论】:

    标签: apache .htaccess loops redirect datalife-engine


    【解决方案1】:

    第一个建议?考虑一个 MVC 框架来减轻像这样的毛茸茸的 .htaccess 文件。

    第二个建议,enable debugging and view the logs 追踪重定向发生的位置。

    【讨论】:

      【解决方案2】:

      在所有这些规则之前添加此规则:

      ## if rewritten already
      RewriteCond %{ENV:REDIRECT_STATUS} ^200$ [OR]
      ## If the request is for a valid directory
      RewriteCond %{REQUEST_FILENAME} -d [OR]
      ## If the request is for a valid file
      RewriteCond %{REQUEST_FILENAME} -f [OR]
      ## If the request is for a valid link
      RewriteCond %{REQUEST_FILENAME} -l
      ## don't do anything
      RewriteRule ^ - [L]
      

      【讨论】:

      • 已编辑,您可以再试一次吗。
      【解决方案3】:

      为什么不启用“检查无效的 SEO URL:是”选项?

      Datalife Engine 使用基于文章 ID 的文章,因此如果您的数据库中的文章 ID 即使“alt_name”不正确,无论您的 SEO URL 是什么,DLE 仍然可以找到您的文章。除非您使用 apache 以外的其他 mod_rewrite,否则文件 .htaccess 应该保持不变。

      【讨论】:

      • 当 alt 名称包含无效字符(如“&”)时,问题出在该名称上。 Datalife 安全过滤该 url 并显示循环错误。我更改了所有这样的网址并解决了问题。顺便谢谢大家。
      猜你喜欢
      • 1970-01-01
      • 2011-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-09
      • 1970-01-01
      • 2014-08-19
      • 1970-01-01
      相关资源
      最近更新 更多