尝试确定为什么只有最后一次重定向才会返回" Too Many Redirects"访问页面时出错。如果我在最后一个之后再添加,他们在访问页面时都会得到相同的错误。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myhrc.biz$ [OR]
RewriteCond %{HTTP_HOST} ^www.myhrc.biz$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofcontractor.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.houstonroofcontractor.com$ [OR]
RewriteCond %{HTTP_HOST} ^bestroofertx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.bestroofertx.com$ [OR]
RewriteCond %{HTTP_HOST} ^roofingcompanyhoustontexas.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.roofingcompanyhoustontexas.com$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofingreviews.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.houstonroofingreviews.com$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofingonline.co$ [OR]
RewriteCond %{HTTP_HOST} ^www.houstonroofingonline.co$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofingonline.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.houstonroofingonline.net$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofingonline.info$ [OR]
RewriteCond %{HTTP_HOST} ^www.houstonroofingonline.info$ [OR]
RewriteCond %{HTTP_HOST} ^houstonroofingonline.com$
RewriteRule (.*)$ http://www.houstonroofingonline.com/$1 [R=301,L]
ErrorDocument 404 http://www.houstonroofingonline.com/404.html
RedirectMatch 301 ^/residential http://www.houstonroofingonline.com/residential-roofing-houston.html
RedirectMatch 301 ^/about-us http://www.houstonroofingonline.com/houston-roofing-company.html
RedirectMatch 301 ^/residential/insurance-claims http://www.houstonroofingonline.com/roof-insurance-claims-houston.html
RedirectMatch 301 ^/residential/free-roof http://www.houstonroofingonline.com/free-roof-insurance-claim.html
RedirectMatch 301 ^/residential/storm-damage http://www.houstonroofingonline.com/storm-damage-roof-repair-houston.html
RedirectMatch 301 ^/residential/roof-inspection http://www.houstonroofingonline.com/free-roof-inspection-houston.html
RedirectMatch 301 ^/residential/roof-repair http://www.houstonroofingonline.com/roof-repair-houston.html
RedirectMatch 301 ^/commercial http://www.houstonroofingonline.com/commercial-roofing-houston.html
RedirectMatch 301 ^/contact-us http://www.houstonroofingonline.com/contact.html
RedirectMatch 301 ^/blog http://www.houstonroofingonline.com/houston-roofing-blog.html
RedirectMatch 301 ^/roofing-system-complexities http://www.houstonroofingonline.com/roofing-systems.html
RedirectMatch 301 ^/how-to-select-roof http://www.houstonroofingonline.com/how-to-select-a-roof.html
RedirectMatch 301 ^/your-roof-as-a-selling-tool http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html

答案 0 :(得分:0)
您的上次重定向导致重定向循环错误/重定向错误太多。 让我们看看为什么会这样:
RedirectMatch 301 ^/your-roof-as-a-selling-tool http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html
实际上,RedirectMatch的模式和目标路径是相同的。
模式:^ / your-roof-as-a-sell-tool *
目标网址 :http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html
当您请求example.com/your-roof-as-a-selling-tool
时,您的RedirectMatch会在第一轮中将网址重定向到
http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html
。在第二轮http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html
匹配模式并重定向到自身。
要避免此多重定向行为,您需要修复模式,使其与目标路径不匹配。只需在末尾添加正则结构end of string
字符 $ ,这样它就只能匹配特定的uri /your-roof-as-a-selling-tool
而不是...tool.html
。
RedirectMatch 301 ^/your-roof-as-a-selling-tool$ http://www.houstonroofingonline.com/your-roof-as-a-selling-tool.html