# Htaccess restrict all but one page

**URL:** <https://forum.kirupa.com/t/htaccess-restrict-all-but-one-page/318348>\
**Category:** Uncategorized\
**Created:** [January 17, 2011, 10:41pm UTC](https://forum.kirupa.com/t/htaccess-restrict-all-but-one-page/318348 "2011-01-17T22:41:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlk](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mlk](https://forum.kirupa.com/u/mlk)\
**Post date:** [January 17, 2011, 10:41pm UTC](https://forum.kirupa.com/t/htaccess-restrict-all-but-one-page/318348/1 "2011-01-17T22:41:36Z")

</div>

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](http://www.root.com/folder/chart) \<— protected  
[www.root.com/folder/chart?v=public\_10](http://www.root.com/folder/chart?v=public_10) \<— protected

_Here’s what i’d like:_

[www.root.com/folder/chart](http://www.root.com/folder/chart) \<— protected  
[www.root.com/folder/chart?v=public\_10](http://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

```auto

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

```

But I’m getting nowhere. Any ideas?

Thanks a million!
