How can I block a range or URL's for all but my IP address.
So ...
Allow http://mydomain.com/* to all users
Block http://mydomain.com/thisdirectoryandallcontents/* to all but my IP
I found some code from another site which might work but I don't have the htaccess skills to adapt it
Options +FollowSymlinks
RewriteEngine on
#urls to exclude
RewriteCond %{REQUEST_URI} !/url-to-exclude-1$
RewriteCond %{REQUEST_URI} !/url-to-exclude-2$
RewriteCond %{REQUEST_URI} !^/images$
RewriteCond %{REQUEST_URI} !^/css$
RewriteCond %{REQUEST_URI} !^/$
#ip to allow access
RewriteCond %{REMOTE_HOST} !^11\.11\.11\.11$
#send to root
RewriteRule .? /http://www.mydomain.com [R=302,L]
I have a similar requirement and do basically the same when I put my page (or a part) on maintenance. The content of the htaccess file looks like this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} /thisdirectoryandallcontents
RewriteCond %{REMOTE_ADDR} !=111.111.111.111
RewriteRule ^.*$ /maintenance.php [R=302,L]
I will explain it step by step according to your requirements: