anon445699
anon445699

Reputation:

PHP htaccess - allow disallow

I have the following htaccess code in my include files directory to protect against direct access.

<Files *>
Deny from all
</Files>

This works fine except for one file which is used for my jquery star rating. Ratings are written to and read from a php file.

I need to modify the above htaccess code so ratings.data.php file is excluded from the deny all.

Something Like:

<Files *>
Deny from all
    Allow ratings.data.php
</Files>

How can I accomplish this? Thank you for your help!

Upvotes: 1

Views: 1155

Answers (2)

m_vitaly
m_vitaly

Reputation: 11952

The Allow/Deny directive sets the clients that can access that portion of the site. So you would need to add another section with something like:

<Files ratings.data.php>
    Allow from all
</Files>

Update: Some clarification.

You need to add both sections:

<Files ratings.data.php>
    Allow from all
    Order Allow,Deny
</Files>

<Files *>
    Deny from all
    Order Deny,Allow
</Files>

Upvotes: 3

German Rumm
German Rumm

Reputation: 5812

Try something like this

<Files ratings.data.php>
Satisfy All  
</Files>`

Upvotes: 0

Related Questions