1

I am trying to restrict access to certain directories to certain IP's.... I have done some research & the below is what I came up with, however it returns a 500 internal server error when I try & access the page..

<Directory "/home/username/public_html/admin/">
    order deny,allow
    deny from all
    allow from 123.45.67.89
    allow from 111.222.333.444
    allow from 123.45.*.*
    allow from 123.44.*.*
</Directory>

<Directory "/home/username/public_html/blog/wp-admin/">
    order deny,allow
    deny from all
    allow from 123.45.67.89
    allow from 111.222.333.444
    allow from 123.45.*.*
    allow from 123.44.*.*
</Directory>

What did I do wrong!?

1

That's not how IP address ranges in the Allow directive work. The * symbol is not in the docs.

You can either write:

Allow from 123.45

or

Allow from 123.45.0.0/255.255.0.0

or

Allow from 123.45.0.0/16

There are other allowed syntax but I find the CIDR notation to be the clearest and most readable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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