[TYPO3-core] RFC #9729: Ship optimal TYPO3 configuration by default

Steffen Kamper info at sk-typo3.de
Wed Mar 11 22:02:17 CET 2009


Hi,

indeed htaccess slows down apache. i found a measuring here:
http://simon.net.nz/articles/benchmarking-htaccess-performance/

The reason is found in Apache documentation:

There are two main reasons to avoid the use of .htaccess files.

The first of these is performance. When AllowOverride is set to allow 
the use of .htaccess files, Apache will look in every directory for 
.htaccess files. Thus, permitting .htaccess files causes a performance 
hit, whether or not you actually even use them! Also, the .htaccess file 
is loaded every time a document is requested.

Further note that Apache must look for .htaccess files in all 
higher-level directories, in order to have a full complement of 
directives that it must apply. (See section on how directives are 
applied.) Thus, if a file is requested out of a directory 
/www/htdocs/example, Apache must look for the following files:

/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess

And so, for each file access out of that directory, there are 4 
additional file-system accesses, even if none of those files are 
present. (Note that this would only be the case if .htaccess files were 
enabled for /, which is not usually the case.)

The second consideration is one of security. You are permitting users to 
modify server configuration, which may result in changes over which you 
have no control. Carefully consider whether you want to give your users 
this privilege. Note also that giving users less privileges than they 
need will lead to additional technical support requests. Make sure you 
clearly tell your users what level of privileges you have given them. 
Specifying exactly what you have set AllowOverride to, and pointing them 
to the relevant documentation, will save yourself a lot of confusion later.

Note that it is completely equivalent to put a .htaccess file in a 
directory /www/htdocs/example containing a directive, and to put that 
same directive in a Directory section <Directory /www/htdocs/example> in 
your main server configuration:

.htaccess file in /www/htdocs/example:
Contents of .htaccess file in /www/htdocs/example

AddType text/example .exm
Section from your httpd.conf file

<Directory /www/htdocs/example>
AddType text/example .exm
</Directory>

However, putting this configuration in your server configuration file 
will result in less of a performance hit, as the configuration is loaded 
once when Apache starts, rather than every time a file is requested.

http://httpd.apache.org/docs/2.0/howto/htaccess.html

vg Steffen


More information about the TYPO3-team-core mailing list