Page 1 of 1

.HTACCESS - One File or Two?

PostPosted: 13. April 2005 15:03
by ozental_uk
Hey there. I'm a little confused about .HTACCESS and hope that you can help me. I have a site that features different directory structures and I have different .HTACCESS files scattered around the site. But I'm wondering, do I need more than one .HTACCESS file?

For example, I have one in:

\htdocs\

Code: Select all
<Limit GET>
order allow,deny
allow from all
deny from 123.123.123.123
deny from anaughty.domain.com
</Limit>


<IfModule mod_rewrite.so>
...various re-write statements go here...
</IfModule>


...and one in \htdocs\phpBB\

Code: Select all
DirectoryIndex index.html index.htm portal.php index.php


...and one in \htdocs\phpBB\admin\

Code: Select all
[url]order deny,allow
allow from 666.666.666.666
deny from all[/url]


The first is to block certain sites from accessing any of my site. The second if to provide some index statements for my phpBB2 site. The third is to block anyone by a specified IP from accessing the admin part of my phpBB forum.

But my question is, do I need all of these and is it bad practice to have so many wandering around a site?

Also, is there a heirachy of .HTACCESS files. By this I mean, do all rules and lines mentioned in my \htdocs\.HTACCESS file apply to all sub-folders off of \htdocs\ or do the rules only apply to that directory?

PostPosted: 13. April 2005 17:20
by Dave_L
From http://httpd.apache.org/docs-2.0/howto/htaccess.html

.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.

PostPosted: 13. April 2005 21:24
by prathapml
Hi,
I suggest this tutorial for .htaccess :
http://javascriptkit.com/howto/htaccess.shtml

PostPosted: 14. April 2005 09:47
by ozental_uk
Thanks.

PostPosted: 16. April 2005 13:06
by sckoh
Hello,
Do you know what to do to remove the .htaccess file from hosting server, with ftp browser?

PostPosted: 16. April 2005 14:47
by ozental_uk
I guess that depends how your site is hosted. Certainly you should be albe to do it via FTP if you have the ability to delete files. This is definately the case for any files that you can upload but there may be certain ISP-related directory files that you there from your ISP that you may not be able to delete.

PostPosted: 16. April 2005 17:33
by prathapml
By ftp _browser_ I dunno what you mean.
But ftp apps do easily delete .htaccess as easily as anything else.
But if you aren't allowed, then you could edit it to blank it out completely.