From: Rich Bowen Date: Wed, 6 May 2026 15:14:21 +0000 (+0000) Subject: Rebuild HTML, metafiles X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b03c43d6e0a068aa82f92c3740f32e001cace2c1;p=thirdparty%2Fapache%2Fhttpd.git Rebuild HTML, metafiles git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933888 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/howto/htaccess.html.en.utf8 b/docs/manual/howto/htaccess.html.en.utf8 index 4f5ef9261e..d82e47b089 100644 --- a/docs/manual/howto/htaccess.html.en.utf8 +++ b/docs/manual/howto/htaccess.html.en.utf8 @@ -32,7 +32,8 @@

.htaccess files provide a way to make configuration -changes on a per-directory basis.

+changes on a per-directory basis, without modifying the main server +configuration files directly.

top

When (not) to use .htaccess files

-

In general, you should only use .htaccess files when - you don't have access to the main server configuration file. There is, - for example, a common misconception that user authentication should - always be done in .htaccess files, and, in more recent years, - another misconception that mod_rewrite directives - must go in .htaccess files. This is simply not the - case. You can put user authentication configurations in the main server - configuration, and this is, in fact, the preferred way to do - things. Likewise, mod_rewrite directives work better, - in many respects, in the main server configuration.

+

If you have access to the main server configuration file, you + should put all of your configuration there instead of in + .htaccess files. This includes user authentication, + mod_rewrite rules, and anything else you might be + tempted to put in .htaccess. Directives in the main + configuration are loaded once at server start, rather than on every + request, and mod_rewrite in particular works better + in server configuration context.

.htaccess files should be used in a case where the content providers need to make configuration changes to the server on a per-directory basis, but do not have root access on the server system. - In the event that the server administrator is not willing to make - frequent configuration changes, it might be desirable to permit + This is common with managed hosting environments, control-panel-based + hosting (such as cPanel or Plesk), and content management systems where + the application ships a .htaccess file as part of its + distribution. In the event that the server administrator is not willing + to make frequent configuration changes, it might be desirable to permit individual users to make these changes in .htaccess files - for themselves. This is particularly true, for example, in cases where - ISPs are hosting multiple user sites on a single machine, and want - their users to be able to alter their configuration.

- -

However, in general, use of .htaccess files should be - avoided when possible. Any configuration that you would consider - putting in a .htaccess file, can just as effectively be - made in a <Directory> section in your main server - configuration file.

+ for themselves.

-

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

+

There are two reasons to prefer the main configuration file + over .htaccess: performance and security.

-

The first of these is performance. When AllowOverride +

Performance: When AllowOverride is set to allow the use of .htaccess files, httpd will look in every directory for .htaccess files. Thus, permitting .htaccess files causes a performance hit, @@ -155,12 +132,11 @@ changes on a per-directory basis.

directory /www/htdocs/example, httpd must look for the following files:

-

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

+
/.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 @@ -168,16 +144,7 @@ changes on a per-directory basis.

.htaccess files were enabled for /, which is not usually the case.)

-

In the case of RewriteRule directives, in - .htaccess context these regular expressions must be - re-compiled with every request to the directory, whereas in main - server configuration context they are compiled once and cached. - Additionally, the rules themselves are more complicated, as one must - work around the restrictions that come with per-directory context - and mod_rewrite. Consult the Rewrite Guide for more - detail on this subject.

- -

The second consideration is one of security. You are permitting +

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 @@ -188,6 +155,22 @@ changes on a per-directory basis.

to the relevant documentation, will save yourself a lot of confusion later.

+

If you need to grant .htaccess access but want to + limit it to specific directives rather than entire categories, use the + AllowOverrideList directive. This + lets you name individual directives that are permitted, providing + finer-grained control than AllowOverride alone:

+ +
# Allow only specific directives, not entire categories
+AllowOverride None
+AllowOverrideList Redirect RedirectMatch RewriteEngine RewriteRule RewriteCond
+ + +

With this configuration, any directive not explicitly listed will + cause a server error if encountered in a .htaccess file. + This is a useful middle ground between full override access and no + override access.

+

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 @@ -206,11 +189,6 @@ changes on a per-directory basis.

</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 httpd starts, rather than every time a file is - requested.

-

The use of .htaccess files can be disabled completely by setting the AllowOverride directive to none:

@@ -284,20 +262,11 @@ changes on a per-directory basis.

Authentication example

-

If you jumped directly to this part of the document to find out how - to do authentication, it is important to note one thing. There is a - common misconception that you are required to use - .htaccess files in order to implement password - authentication. This is not the case. Putting authentication directives - in a <Directory> - section, in your main server configuration file, is the preferred way - to implement this, and .htaccess files should be used only - if you don't have access to the main server configuration file. See above for a discussion of when you should and should - not use .htaccess files.

- -

Having said that, if you still think you need to use a - .htaccess file, you may find that a configuration such as - what follows may work for you.

+

As with any .htaccess use, placing these directives in + a <Directory> block is + preferred when you have access to the main configuration (see + above). The following example shows the + .htaccess approach:

.htaccess file contents:

@@ -317,10 +286,10 @@ Require group admins

Server Side Includes example

-

Another common use of .htaccess files is to enable - Server Side Includes for a particular directory. This may be done with - the following configuration directives, placed in a - .htaccess file in the desired directory:

+

Another use of .htaccess files is to enable Server Side + Includes for a particular directory. This may be done with the following + configuration directives, placed in a .htaccess file in + the desired directory:

Options +Includes
 AddType text/html "shtml"
@@ -358,19 +327,29 @@ slash is removed from the value supplied to mod_rewrite documentation for
-further details on using mod_rewrite.

+further details on using mod_rewrite.

top

CGI example

-

Finally, you may wish to use a .htaccess file to permit - the execution of CGI programs in a particular directory. This may be +

CGI scripts are a legacy mechanism for dynamic content. For new + deployments, consider using mod_proxy_fcgi with a + FastCGI application server, or a framework-specific handler. The + information below remains useful for environments that still rely on + traditional CGI.
+ +

You may wish to use a .htaccess file to permit the + execution of CGI programs in a particular directory. This may be implemented with the following configuration:

Options +ExecCGI
-AddHandler cgi-script "cgi" "pl"
+AddHandler cgi-script "cgi" "py"

Alternately, if you wish to have all files in the given directory be @@ -399,8 +378,14 @@ SetHandler cgi-script

Most commonly, the problem is that AllowOverride is not set such that your configuration directives are being honored. Make sure that you don't have a AllowOverride None in effect - for the file scope in question. A good test for this is to put garbage - in your .htaccess file and reload the page. If a server error is + for the file scope in question. A good test for this is to put a + nonsense word in your .htaccess file and reload the + page:

+ +
TestMe
+ + +

If a server error (HTTP 500) is not generated, then you almost certainly have AllowOverride None in effect.

@@ -409,9 +394,8 @@ SetHandler cgi-script that the directive used in your .htaccess file is not permitted.

-

- [Fri Sep 17 18:43:16 2010] [alert] [client 192.168.200.51] /var/www/html/.htaccess: DirectoryIndex not allowed here -

+
[Tue May 06 09:12:31.528374 2025] [core:alert] [pid 12345] [client 192.168.1.50:54321] /var/www/html/.htaccess: DirectoryIndex not allowed here
+

This will indicate either that you've used a directive that is never permitted in .htaccess files, or that you simply @@ -423,9 +407,8 @@ SetHandler cgi-script

Alternately, it may tell you that you had a syntax error in your usage of the directive itself.

-

- [Sat Aug 09 16:22:34 2008] [alert] [client 192.168.200.51] /var/www/html/.htaccess: RewriteCond: bad flag delimiters -

+
[Tue May 06 09:14:02.946218 2025] [core:alert] [pid 12345] [client 192.168.1.50:54321] /var/www/html/.htaccess: RewriteCond: bad flag delimiters
+

In this case, the error message should be specific to the particular syntax error that you have committed.

diff --git a/docs/manual/howto/htaccess.html.es.utf8 b/docs/manual/howto/htaccess.html.es.utf8 index ca4449ce7c..b32dee5239 100644 --- a/docs/manual/howto/htaccess.html.es.utf8 +++ b/docs/manual/howto/htaccess.html.es.utf8 @@ -30,6 +30,10 @@  ko  |  pt-br 

+
Esta traducción podría estar + obsoleta. Consulte la versión en inglés de la + documentación para comprobar si se han producido cambios + recientemente.

Los ficheros .htaccess facilitan una forma de realizar cambios en la configuración en contexto directorio.

diff --git a/docs/manual/howto/htaccess.html.fr.utf8 b/docs/manual/howto/htaccess.html.fr.utf8 index dad4ef407f..25e78cf9c9 100644 --- a/docs/manual/howto/htaccess.html.fr.utf8 +++ b/docs/manual/howto/htaccess.html.fr.utf8 @@ -30,6 +30,8 @@  ko  |  pt-br 

+
Cette traduction peut être périmée. Vérifiez la version + anglaise pour les changements récents.

Les fichiers .htaccess fournissent une méthode pour modifier la configuration du serveur au niveau de chaque répertoire.

diff --git a/docs/manual/howto/htaccess.xml.es b/docs/manual/howto/htaccess.xml.es index d60345c5e5..816aab7a5e 100644 --- a/docs/manual/howto/htaccess.xml.es +++ b/docs/manual/howto/htaccess.xml.es @@ -1,7 +1,7 @@ - + + diff --git a/docs/manual/howto/htaccess.xml.ja b/docs/manual/howto/htaccess.xml.ja index 7ec014a453..4765045548 100644 --- a/docs/manual/howto/htaccess.xml.ja +++ b/docs/manual/howto/htaccess.xml.ja @@ -1,7 +1,7 @@ - + + + + + diff --git a/docs/manual/misc/perf-tuning.html.en.utf8 b/docs/manual/misc/perf-tuning.html.en.utf8 index 5af3b1389f..9afba0f22a 100644 --- a/docs/manual/misc/perf-tuning.html.en.utf8 +++ b/docs/manual/misc/perf-tuning.html.en.utf8 @@ -744,7 +744,7 @@ NO_LINGCLOSE, but this is not recommended at all. In particular, as HTTP/1.1 pipelined persistent connections come into use, lingering_close is an absolute - necessity (and + necessity (and pipelined connections are faster, so you want to support them).

diff --git a/docs/manual/misc/perf-tuning.xml.fr b/docs/manual/misc/perf-tuning.xml.fr index 504657644f..d98bea51a7 100644 --- a/docs/manual/misc/perf-tuning.xml.fr +++ b/docs/manual/misc/perf-tuning.xml.fr @@ -1,7 +1,7 @@ - + diff --git a/docs/manual/misc/perf-tuning.xml.ko b/docs/manual/misc/perf-tuning.xml.ko index 3c70e4d64c..8f05f80341 100644 --- a/docs/manual/misc/perf-tuning.xml.ko +++ b/docs/manual/misc/perf-tuning.xml.ko @@ -1,7 +1,7 @@ - + + + + + diff --git a/docs/manual/mod/core.xml.ja b/docs/manual/mod/core.xml.ja index d3771c1314..c32d72f9c5 100644 --- a/docs/manual/mod/core.xml.ja +++ b/docs/manual/mod/core.xml.ja @@ -1,7 +1,7 @@ - + + +