5

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?

Matt Rogers
  • 83
  • 1
  • 7
  • Update. I believe that the issue is that the directive is ignore when using virtualhosts (which we are). Anyone know the correct alternative? When I try end use it's failing with " not allowed here". Help! – Matt Rogers Nov 08 '11 at 15:26
  • Ok - am now answering my own question for the sake of others. Firstly both respondents helped with this one to track the issue. The problem is that when using VirtualHosts the Files directive in a .htaccess is ignored and that Location and Directory don't work. The workaround is very simple. You create another .htaccess in the sub-folder you are trying to open up. – Matt Rogers Nov 08 '11 at 15:35

3 Answers3

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.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
  • Updated - the issue is that Apache is ignore whatever I put in the Directive. Any help much appreciated. – Matt Rogers Nov 08 '11 at 15:19
  • 1
    Ok - am now answering my own question for the sake of others. Firstly both respondents helped with this one to track the issue. The problem is that when using VirtualHosts the Files directive in a .htaccess is ignored and that Location and Directory don't work. The workaround is very simple. You create another .htaccess in the sub-folder you are trying to open up. – Matt Rogers Nov 08 '11 at 19:36
1

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.

Antti Rytsölä
  • 661
  • 4
  • 9
0

Ok - am now answering my own question for the sake of others. Firstly both respondents helped with this one to track the issue.

The problem is that when using VirtualHosts the Files directive in a .htaccess is ignored and that Location and Directory don't work.

The workaround is very simple. You create another .htaccess in the sub-folder you are trying to open up.

Matt Rogers
  • 83
  • 1
  • 7