Htaccess restrict all but one page

hello kirupians

I’ve setup an htaccess to Deny a directory from All, and then allow individual ips (which are generated by php). I know there are better methods to secure a website, but the way the folder structure is set-up means I can’t.

Anyhow, the deny/allow for some ips works pretty well, but there’s a single page inside of the ‘protected’ folder I’d like everybody to see, but it’s not in a separated folder so I can’t htaccess it on its own.

Here’s what’s happening:

www.root.com/folder/chart <— protected
www.root.com/folder/chart?v=public_10 <— protected

Here’s what i’d like:

www.root.com/folder/chart <— protected
www.root.com/folder/chart?v=public_10 <— access for all

I can’t use a simple $_GET in the php file, it has to be with htaccess. I’ve tried fiddly with


<FilesMatch "^?v=public_([0-9]{2})$">
Allow from all
</FilesMatch>

But I’m getting nowhere. Any ideas?

Thanks a million!