Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

301 Redirect error

"Redirection limit exceeded"



10:56 am on Jun 8, 2005 (gmt 0)

10+ Year Member

I've done a redirect in a .htaccess using

"redirect 301 / [sub.example.com...]

and Firefox is giving me an error message saying:

"Redirection limit for this URL exceeded. Unable to load the requested page. This maybe caused by cookies that are blocked"

I've tried allowing all cookies but it makes no difference. Both addresses are in the same subdomain of the same TLD.

Any ideas?


2:06 pm on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Sounds like an infinite loop. Are you sure that the target of the redirect doesn't point to itself?


2:21 pm on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

To expand on the previous post, because it is unconditional, your Redirect will also be invoked for the redirected request, leading to a loop:

1st request: /somefile -> redirects to /folder/somefile
2nd request: /folder/somefile -> redirects to /folder/folder/somefile
3rd request: /folder/folder/somefile -> redirects to /folder/folder/folder/somefile

etc. This continues until the maximum redirection limit for either the browser or the server is reached, whichever is lower.

If you have sufficient permissions from your host to use mod_rewrite [httpd.apache.org] in .htaccess, then you can test the requested folder, and only redirect if "/folder" is not present in the request. This will prevent the looping. Something like:

Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^folder/
RewriteRule (.*) /folder/$1 [L]

This code also generates a server-internal rewrite rather than an external redirect, hiding the location change from users and robots.



2:26 pm on Jun 8, 2005 (gmt 0)

10+ Year Member

OK, that sounds likely, because I don't know what I'm doing with this stuff yet. I'll probably draw myself a diagram to make it clearer.

Thanks guys!


3:07 pm on Jun 9, 2005 (gmt 0)

10+ Year Member

I still don't know what I'm doing with this :(

I've got sub.mydomain.com which I want to go to sub.mydomain.com/dir/

The host lets me do mod_rewrite but I've only ever used it with the automatic thing in WordPress, so if I try that it'll probably mess up as well


Featured Threads

Hot Threads This Week

Hot Threads This Month