Redirection by IP causing infinite loop

I am working to transfer a server from one box to another and do a massive code update tonight. To do this I'd like to set up a redirection so that normal site visitors go to a holding page. But developers and testers and the client go to the main site.

I am thinking that an 403 redirection is the way to do it. This is the code I'm using:

Order allow,deny
deny from 80.195.185.214
allow from all
ErrorDocument 403 /holding/index.html
<Files /holding/index.html>
    allow from all
</Files>

Currently I am just redirectly my IP, I'll swap that around this evening.

Anyway the problem I am getting "This webpage has a redirect loop" on the holding page. Clearly the "Allow From All" directive isn't being process.

Does anyone know what I might be getting wrong?


Solution 1:

The HTTP response code 403 is "Forbidden". It is not a redirect.

The error message "This webpage has a redirect loop" indicates that there is a redirect happening somewhere (this means a 3xx response such as 301 or 302). You may have a .htaccess file or there may be some other part of the Apache config that is causing the redirect to be sent as the response.

Try requesting the page using curl -I or wget -q -S -O /dev/null to find out exactly what response is being sent.

Solution 2:

Order allow,deny -> Order deny,allow

http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order

Allow,Deny First, all Allow directives are evaluated; at least one must match, or the request is rejected. Next, all Deny directives are evaluated. If any matches, the request is rejected. Last, any requests which do not match an Allow or a Deny directive are denied by default.

Deny,Allow First, all Deny directives are evaluated; if any match, the request is denied unless it also matches an Allow directive. Any requests which do not match any Allow or Deny directives are permitted.