This is a discussion on Restrict access to localhost only within the Apache Web Server forums, part of the Web Server and Related Forums category; I want to prevent access to a specific directory with a .htaccess file. Only the local PHP module should be ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I want to prevent access to a specific directory with a .htaccess file. Only the
local PHP module should be allowed to access that directory. I've put a .htaccess file in the directory: <Directory /> Order Deny,Allow Deny from all Allow from (server's address here) </Directory> but it does not seem to work, though. By the way, would "localhost" be a legal address in this directive? Thanks, Jörg |
|
|||
|
Jörg Ellermann wrote:
> I want to prevent access to a specific directory with a .htaccess file. Only the > local PHP module should be allowed to access that directory. > > I've put a .htaccess file in the directory: > > <Directory /> > Order Deny,Allow > Deny from all > Allow from (server's address here) > </Directory> > > but it does not seem to work, though. By the way, would "localhost" be a legal > address in this directive? Yes, localhost or 127 (as in 127.0.0.1) <Directory /> Order Deny,Allow Deny from all Allow from 127 Allow from example.net </Directory> Consider keeping whatever files these are out of the document root, that is, outside of public_html or whatever. -- Matt -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =----- |
|
|||
|
Matt wrote:
>>I've put a .htaccess file in the directory: >> >><Directory /> >>Order Deny,Allow >>Deny from all >>Allow from (server's address here) >></Directory> >> >>but it does not seem to work, though. > Yes, localhost or 127 (as in 127.0.0.1) > > <Directory /> > Order Deny,Allow > Deny from all > Allow from 127 > Allow from example.net > </Directory> Thanks for answering. Although I've already found it - I didn't change the main server config to allow .htaccess overrides. BTW, after changing that, the above resulted in a sever error - <Directory> is not allowed in .htaccess files. Jörg |
|
|||
|
Jörg Ellermann wrote:
> Matt wrote: > >> <Directory /> >> Order Deny,Allow >> Deny from all >> Allow from 127 >> Allow from example.net >> </Directory> > > Thanks for answering. Although I've already found it - I didn't > change the main server config to allow .htaccess overrides. > > BTW, after changing that, the above resulted in a sever error - > <Directory> is not allowed in .htaccess files. Well... Think of the .htaccess file as having an implicit "<Directory .>" :-) -- MVH Jeppe Uhd - NX http://nx.dk Webhosting for nørder og andet godtfolk |
|
|||
|
On Tue, 24 Aug 2004 01:54:10 +0200, Jörg Ellermann
<j.ellermann@tu-bs.de> wrote: >I want to prevent access to a specific directory with a .htaccess file. Only the >local PHP module should be allowed to access that directory. > >I've put a .htaccess file in the directory: > ><Directory /> >Order Deny,Allow >Deny from all >Allow from (server's address here) ></Directory> > >but it does not seem to work, though. By the way, would "localhost" be a legal >address in this directive? > >Thanks, >Jörg watch out: .htaccess is read at each request, so can give a degradation in performance. So IMHO it is best used by the maintainer of the directory it is in. The server owner should put all his stuff in httpd.conf, which is only accessed on server startup. .. frgr Erik |