.htaccess - Apache: include htaccess in conf with AllowOverride None, better performance? -


suppose have /home/example.org/public_html/ directory on filesystem, serves document root of virtualhost.

the relevant httpd configuration vhost this:

<virtualhost *:80>   servername example.org:80   ...   documentroot /home/example.org/public_html   <directory /home/example.org/public_html>     allowoverride     ...   </directory>   ... </virtualhost> 

in order prevent htaccess lookups on filesystem without losing htaccess functionality – @ least @ documentroot level- transformed configuration following:

<virtualhost *:80>   servername example.org:80   ...   documentroot /home/example.org/public_html   <directory /home/example.org/public_html>     allowoverride none     include /home/example.org/public_html/.htaccess     ...   </directory>   ... </virtualhost> 

difference

allowoverride none include /home/example.org/public_html/.htaccess 

let’s see have accomplished this:

httpd not waste time looking , parsing htaccess files resulting in faster request processing

questions:

  1. using include directive, apache load htaccess on service start or each request?
  2. if point 1 it's true, how refresh apache conf without httpd.exe -k restart?

apache accesses , processes htaccess files on each request. why 1 not need restart server every time check current configurations.

you need restart server/service testing changes made apache.conf, httpd.conf or vhost configurations.


quoting apache's tutorial on htaccess file:

you should avoid using .htaccess files if have access httpd main server config file. using .htaccess files slows down apache http server. directive can include in .htaccess file better set in directory block, have same effect better performance.


since trying include htaccess inside <directory> module block, performance better if include file block instead. there is, although no difference; apart having maintain configurations in 2 places simultaneously.

the htaccess file processed once, @ time of server start.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -