aslum
aslum

Reputation: 12254

htaccess Deny All for certain files and allow by IP for the rest

I've recently upgraded a web app and I want to combine the new and old htaccess into one file. Here is my new htaccess:

<Files ~ "\.inc$">
   Order allow,deny
   Deny from all
</Files>

And my old htaccess:

order deny,allow
deny from all
Allow from 12.34.567.89
Allow from 12.34.567.88

My end goal is that No One can access the *.inc but only the approved IPs can access the rest of the folder. Can I just concatenate these two rules in one file?

Upvotes: 1

Views: 97

Answers (1)

anubhava
anubhava

Reputation: 785128

Yes you can use:

order deny,allow
deny from all
Allow from 12.34.567.89
Allow from 12.34.567.88

<Files ~ "\.inc$">
   Order allow,deny
   Deny from all
</Files>

Upvotes: 1

Related Questions