Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Update. I believe that the issue is that the <files> directive is ignore when using virtualhosts (which we are). Anyone know the correct alternative? When I try end use <Location> it's failing with "<Location> not allowed here". Help! –  Matt Rogers Nov 8 '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 8 '11 at 15:35
add comment

3 Answers 3

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.

share|improve this answer
    
Updated - the issue is that Apache is ignore whatever I put in the <Files> Directive. Any help much appreciated. –  Matt Rogers Nov 8 '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 8 '11 at 19:36
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.