Report message:*
 

Restrict access via htaccess based on host

Subject: Restrict access via htaccess based on host
by phoenyx on 2010/1/8 3:54:16

I want to restrict access to specific patterns to localhost only.

Current .htaccess:
RewriteEngine On
RewriteRule latest.html latest.php [L]
RewriteRule ^([^/]*)\.xml$ xmlfactory.php?id=$1 [L]

What I want to have is:
- Everybody should be allowed to access latest.html. The second rule however, should only apply for anyone not being localhost. So in case I'm going to visit the website via my browser I should see a 403 Forbidden. In case the server is querying itself, it should get access to the file.

Is it possible to do it with
RewriteCond %{REMOTE_ADDR} somehow?

Please help me