Better way is to do this in your .conf
file:
<Directory /hidedirectory>
options -Indexes
Order Deny,Allow
Deny from all
Allow from XX.XXX.XX.XXX
</Directory>
This will deny everythig like your rewrite rules.
But since you want to allow access to images/css etc...
RewriteCond %{REMOTE_ADDR} !^XX.XXX.XX.XXX$
RewriteCond %{REQUEST_URI} !.(?:jpe?g|png|gif|css)$ [NC]
RewriteRule ^hidedirectory(.*)$ http://site.com/ [R,L]
Add any other extensions into (?:jpe?g|png|gif|css)
suffixed by a |
(or).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…