Forum Moderators: phranque

Message Too Old, No Replies

.htaccess

deny browser or bot access

         

jim_w

2:52 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does the code below deny access to the .htaccess file for browsers and bots?

<Files .*>
Order allow,deny
Deny from all
</Files>

Also, in the structure of the .htaccess file, does it matter where it is placed?

For example, is below the...

Options +FollowSymLinks
RewriteEngine on

alright?

Thanks

jdMorgan

3:15 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Does the code below deny access to the .htaccess file for browsers and bots?

Yes, and it denies access to all other files as well...

You probably want to use <Files ~ "^\.htaccess$"> or <Files ~ "^\.ht">

The order of directive placement in .htaccess only matters among directives which are processed by the same module. Apache calls each module in turn to process the directives, so the order of module execution is determined by your server configuration, while the order of execution among directives processed by one module are determined by the order you put them in your .htaccess file.

As such, it doesn't matter whether you place your. htaccess file protection code above or below the Options and RewriteEngine directives, because your .htaccess protection code (order, allow, deny) is handled by mod_access, Options is handled by Apache core, and RewriteEngine is handled by mod_rewrite.

In Apache pre-2.0 modules are processed in the reverse order that they appear in the LoadModule list. In Apache 2.0 and later, each module is assigned a priority, and the order of execution is controlled by that.

Jim

jim_w

3:22 am on Oct 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great. Thanks Jim.

I wasn't sure if the lines were processed one at a time like in old basic, in which case I would have wanted it as the 1st line I guess, or if the file was all read in and then processed.

I tip my hat to ya.