Forum Moderators: phranque

Message Too Old, No Replies

HTTP Redirection

SIte not indexed due to redirects

         

wellbornSun

4:01 am on Jan 18, 2008 (gmt 0)

10+ Year Member



I submitted my site to this Search Engine Simulator to see if/how/ my page would look to search engines, and this is what I got:
[ example.com / 50 bytes / Error too many levels of HTTP redirection ]. Does anybody know what this means and how to fix it? Related to this is, what should I put in an .htaccess file for a basic/static web site? Is htere a list of things I should/should not put in there?

[edited by: tedster at 6:08 am (utc) on Jan. 18, 2008]
[edit reason] no member domains, please [/edit]

jdMorgan

1:17 pm on Jan 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error message indicates that you have one or more directives which invoke a redirect without checking to be sure that the requested URL has not already been redirected. Therefore, you are getting an 'infinite' redirection loop, and the client (the simulator) is giving up.

Jim

wellbornSun

6:33 pm on Jan 20, 2008 (gmt 0)

10+ Year Member



I'm following you...a little:) Here is exactly what is in the .htaccess file. Can you tell what needs to be removed or modified? One last thing. Should the .htaccess file be in the root directory or the public_html directory?

<Files .htaccess>
order allow,deny
deny from all
</Files>
Options -Indexes
ErrorDocument 404/errors/404.htm
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

[edited by: jdMorgan at 7:11 pm (utc) on Jan. 20, 2008]
[edit reason] example.com [/edit]

jdMorgan

7:19 pm on Jan 20, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code looks OK. Unfortunately, that means that some other agent -- perhaps code in httpd.conf, or possibly in one of your scripts (if you use any), is doing a second redirect which interacts with this one.

I'd recommend using the "Live HTTP Headers" add-on for Firefox/Mozilla browsers to examine the redirection sequence to see if it gives you a hint.

If you use a "control panel" make sure that you have not previously configured a redirect that conflicts with your .htaccess redirect -- For example, if there is any redirect from www.example.com to example.com, then that redirect and your new .htaccess redirect will each countermand the other, and you'll get a loop.

As mentioned, be sure you don't have a script that redirects to non-www.

Also, be aware that your ErrorDocument syntax shown above is invalid. It is missing a required space. The line should read:


ErrorDocument 404 /errors/404.htm

Your .htaccess should go in your Web root "home page" directory, or optionally in the server root -- But the real test is whether it works. :)

Jim