Options +ExecCGI
# Allow execution of .cgi scripts.
AddHandler cgi-script .cgi
# Protect files and directories from prying eyes.
<FilesMatch ".(lua|engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(.html)?|xtmpl|svn-base)$|^(..*|code-style.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>
# Handle any 404 errors.
ErrorDocument 404 /index.cgi
# Set the default handler.
DirectoryIndex index.cgi
# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>
# Etags rules.
<IfModule mod_headers.c>
# Disabled:
# FileETag None
# Enable Etags:
# FileETag MTime Size
# Enable Etags in a clustered environment:
# FileETag MTime Size
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Do not allow access to "hidden" directories whose names begin with period.
# NOTE: This only works when mod_rewrite is loaded.
RewriteRule "(^|/)." - [F]
# Rewrite URLs of the form 'x' to the form 'index.cgi?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
# Don't care about image files
RewriteCond %{REQUEST_URI} !.(jpg|JPG|gif|GIF|png|PNG|ico|ICO|svg|SVG)$
RewriteRule ^(.*)$ index.cgi [L]
</IfModule>