Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I say 'not working' I don't mean it's broken. I mean I can't get it to work so I must be doing something wrong. (I am new to this)

I have the following code in a htaccess file placed in the folder I want to restrict access to...

<Limit GET>
Order deny,allow
Deny from all
Allow from [the ip address I'm trying to allow]
</Limit>

I have checked that the AccessFileName directive is set in apache2.conf

I reboot the server after each edit of the file.

The file is set with 644 permissions.

And I am still able to access the site from ips other than the one I'm allowing.

What am I doing wrong?

share|improve this question
    
Could you self-answer the question? Instead of using "solved" in the title you could accept the answer so the Q/A structure is maintained. –  Nanne Oct 27 '12 at 12:38
    
I'll do that. I did it the way I did because I've often seen it done that way. –  MrVimes Oct 27 '12 at 12:40
    
If all goes rite, not on "stackexchange" sites. Anyway, +1 for you answer :) –  Nanne Oct 27 '12 at 12:53

1 Answer 1

up vote 2 down vote accepted

After some googling I found out that in order for htaccess files in folders other than the root to be taken into account by the server, the directive 'AllowOverride' needs to be set to 'All' for that site in /etc/apache2/sites-available/ (in my case the default site)

There may be other ways to acheive the same result but this is the one I found.

share|improve this answer
    
Apache didn't like it when I added AllowOverride to my site in the sites-available directory. "AllowOverride not allowed here". Apache wouldn't start. –  Nicholas Pickering Mar 10 '13 at 9:50

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.