Forum Moderators: phranque

Message Too Old, No Replies

Infinite Redirect Loop

Fetch as Google is giving me this error

         

debc

4:44 pm on Oct 15, 2012 (gmt 0)

10+ Year Member



When I Fetch my blog as Google in Webmaster Tools (http://www.mysite.com/blog) WITHOUT a trailing slash at the end, I get this error:

The page seems to redirect to itself. This may result in an infinite redirect loop HTTP/1.1 301 Moved Permanently


When I Fetch my blog as Google WITH the trailing slash at the end(http://www.mysite.com/blog/), it is fine without errors. HTTP/1.1 200 OK



My .htaccess file in the root directory contains this:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.htm\ HTTP/
RewriteRule ^index\.htm$ [mysite.com...] [R=301,L]
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^(.*)$ [mysite.com...] [R=301,L]

My .htaccess file in the blog directory contains this:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_URI} ^.*/index.php/.* [NC]
RewriteRule ^index\.php/(.*)$ [mysite.com...] [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

Do I have something incorrectly coded in these .htaccess files that could be causing this? Or is there something else I should look at?

Thank you for any help!

g1smd

6:52 pm on Oct 15, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Use example.com in this forum to suppress URL auto-linking.

This appears to be a bug with Google, as I see that on a number of sites and it isn't true.

That said, there are numerous errors in your code; errors that we discuss here on an at least weekly basis.

lucy24

6:59 pm on Oct 15, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When I Fetch my blog as Google in Webmaster Tools (http://www.mysite.com/blog) WITHOUT a trailing slash at the end, I get this error:

The page seems to redirect to itself. This may result in an infinite redirect loop HTTP/1.1 301 Moved Permanently

I detoured to try this on a (real) directory-index page of my own to see if I'd get the same error, but it seems to be a wordpress problem. Or, in this case, a non-problem.

A page redirecting to itself is exactly what happens if you ask for a (real, physical) directory without the trailing slash-- no "appears to" about it. But it doesn't go on to re-redirect to the slashless version, so I honestly don't know what g### is going on about. I think it's just confused by wordpress rewriting.

This line from the wordpress boilerplate
RewriteCond %{REQUEST_URI} ^.*/index.php/.* [NC]

is pretty atrocious-- but not half so atrocious as the sample line I found on
:: cough-cough ::
Apache's own site. I think it was in the wiki, but that's no excuse ;) While I was trying to find it, g1 nipped in and posted ahead of me. Oh well.

And, ahem, you've been lurking long enough to know that you gotta use "example.com". Or example dot something, at least.

debc

7:47 pm on Oct 15, 2012 (gmt 0)

10+ Year Member



Thanks so much for your replies, and I'm sorry about not using example.com!

So, from what you've both said this is a non-issue and I shouldn't worry about it. But, what I do need to work on is cleaning up my code.

Is it better if I combine the .htaccess files and have just one in my root folder?

g1smd

8:40 pm on Oct 15, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, it is much better to combine them as well as fix all the other errors.