2010/1/8 3:54:16
|
---|
|
Restrict access via htaccess based on hostI 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 |
2010/1/8 11:34:44
|
---|
|
Re: Restrict access via htaccess based on hostNever mind. Seems not to work anyway.
However, in case someone knows: Please answer anyway. This might be helpful for someone else as well. |
2010/1/9 12:20:19
|
---|
|
Re: Restrict access via htaccess based on hostI am not sure which file you are trying to block - but its rather simple to do whatever the file is.
you would need to use an allow deny rule. ex:
<Files ~ "^\.xml">
Order allow,deny
Deny from all
</Files> You can do specific filenames whatever. you can also allow say only certain refers to access.
<Files ~ "^\.xml">
Order allow,deny
Deny from all
Allow from .somedomain.com
Allow from .someotherdomain.com
</Files> Check it HTH |
2010/1/9 12:25:39
|
---|
|
Re: Restrict access via htaccess based on hostThe question was whether it's possible to allow access to certain files only for the server itself (not for access via the client = brower)
|
2010/1/9 13:55:29
|
---|
|
Re: Restrict access via htaccess based on hostand it was answered.
Either I am not understanding the question - or you aren't understanding the answer. using allow/deny does not block the server. just blocks http access for those on the deny list. |
2010/1/10 2:57:45
|
---|
|
Re: Restrict access via htaccess based on hostok then. I just got it wrong .
Thank you for your answer. I didn't know that it doesn't effect the server. |