1

Inside my .htaccess file, I have the following script:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^([^\.]+)$ $1.php [NC,L]
</IfModule>

Apparently, if I use the Fetch as Bingbot function from Bing Webmaster Tools, and I use HTTP over HTTPS, the redirect does happen, but the message the bingbot returns is:

HTTP/1.1 301 Moved Permanently
Connection: Keep-Alive
Date: Thu, 02 Jan 2014 22:56:55 GMT
Keep-Alive: timeout=5
Content-Length: 235
Content-Type: text/html; charset=iso-8859-1
Location: https://hsoto.me/index2.php
Server: Apache mod_fcgid/2.3.10-dev



<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://hsoto.me/index2.php">here</a>.</p>
</body></html>

And the status message it returns is:

URL:  http://hsoto.me/index2.php
Status:  Redirection limit reached.

Google Webmaster Tools is just about fine, and my page is even found by typing the address of the website at least. This is not the case on Bing. Any idea why this might be happening?

Additional information:

1-Hosting this domain with Godaddy

2-Website has been up for about 4 days.

Help would be appreciated!

EDIT

function detectIElessThan10(){
     if(preg_match('/(?i)msie [2-9]/',$_SERVER['HTTP_USER_AGENT'])){
        header("Location:https://www.hsoto.me/nosupport");
    } 
}

That's the PHP code I'm using to redirect. I also found out that the https URL on Bing does work, but the http doesn't, Bingbot brings the first, the second one, well throws the error previously mentioned.

6
  • Is there any additional redirection happening anywhere, such as in the Meta tags or PHP code?
    – dan
    Jan 3, 2014 at 1:57
  • Not at all. Well actually there is, I'm redirecting users to hsoto.me/nosupport.php if they have internet explorer 9 or less. Will that be causing the issue?
    – codeninja
    Jan 3, 2014 at 2:04
  • 1
    Edited my post with the code I'm using and further information I have found.
    – codeninja
    Jan 3, 2014 at 3:21
  • @Yisera have you tried removing the code RewriteCond %{HTTPS} off isn't this turning HTTPS off then you rewrite to your HTTPS secure server? Wouldn't that create an infinite redirect loop? In Bing and Google webmaster tools have you specified https as your primary domain.
    – Anagio
    Jan 3, 2014 at 3:40
  • I found that script on stackoverflow, I do not know much how does .htaccess works. What is the propper way to do 301 redirect?
    – codeninja
    Jan 3, 2014 at 3:58

1 Answer 1

4

Bingbot is not "crashing". The "Fetch as Bingbot" tool within Bing's Webmaster Tools simply does not follow redirects:

From bing webmaster help:

WHAT DOES "REDIRECTION LIMIT REACHED MEAN"?
Unlike the SEO Analyzer tool, Fetch as Bingbot does not follow redirects. Instead it will let you know that the page resulted in a redirect and shows you the HTTP headers it received from your server.

You get the same notice for any redirect. eg. non-www to www redirection, or vice versa.

The actual bingbot that crawls and indexes your website does follow redirects. But you should only be submitting the canonical URL to the search engines anyway. If the canonical URL is HTTPS://example.com then that is the URL you should be submitting, not HTTP://example.com.

Your htaccess code looks OK, although it could be simplified a bit...

RewriteEngine on

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

The line RewriteCond %{HTTPS} off simply checks to see whether HTTPS is currently "off" and will only redirect if that condition is met. It does not turn HTTPS off (as is mentioned in comments).

Google Webmaster Tools is just about fine

The "Fetch as Google" tool is actually very similar to Bing's tool. Except that it indicates "Success" (ie. no error state like a 404 etc.). However, if you click on the word "Success" then you are shown the actual response that Googlebot received... which is exactly the same as what you are seeing from the "Fetch as Bingbot" tool. ie. the redirection, not the final page as a result of the redirection. This is the same as what your browser sees, except the browser makes a second request for the redirected page.

2
  • Excelent answer! Thank you very much. So in other words is able to get to my website?
    – codeninja
    Jan 3, 2014 at 19:08
  • Yes. If there are any serious issues then bing webmaster tools should alert you. Also check the crawl information (Reports & Data) periodically.
    – MrWhite
    Jan 4, 2014 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.