github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/htaccessFiles/.htaccess3 (about)

     1  # Set the Time Zone of your Server
     2  SetEnv TZ America/Las_Vegas
     3  
     4  # ServerAdmin:  This address appears on some server-generated pages, such as error documents.
     5  SetEnv SERVER_ADMIN webmaster@askapache.com
     6  
     7  # Possible values for the Options directive are "None", "All", or any combination of:
     8  #  Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
     9  Options -ExecCGI -MultiViews -Includes -Indexes FollowSymLinks
    10  
    11  # DirectoryIndex: sets the file that Apache will serve if a directory is requested.
    12  DirectoryIndex index.html index.php /index.php
    13  
    14  # Action lets you define media types that will execute a script whenever
    15  # a matching file is called. This eliminates the need for repeated URL
    16  # pathnames for oft-used CGI file processors.
    17  # Format: Action media/type /cgi-script/location
    18  # Format: Action handler-name /cgi-script/location
    19  #
    20  Action php5-cgi /bin/php.cgi
    21  
    22  # AddHandler allows you to map certain file extensions to "handlers":
    23  # actions unrelated to filetype. These can be either built into the server
    24  # or added with the Action directive (below)
    25  #
    26  # To use CGI scripts outside of ScriptAliased directories:
    27  # (will also need to add "ExecCGI" to the "Options" directive.)
    28  #
    29  AddHandler php-cgi .php .inc
    30  
    31  # Commonly used filename extensions to character sets.
    32  AddDefaultCharset UTF-8
    33  
    34  # AddType allows you to add to or override the MIME configuration
    35  AddType 'application/rdf+xml; charset=UTF-8' .rdf
    36  AddType 'application/xhtml+xml; charset=UTF-8' .xhtml
    37  AddType 'application/xhtml+xml; charset=UTF-8' .xhtml.gz
    38  AddType 'text/html; charset=UTF-8' .html
    39  AddType 'text/html; charset=UTF-8' .html.gz
    40  AddType application/octet-stream .rar .chm .bz2 .tgz .msi .pdf .exe
    41  AddType application/vnd.ms-excel .csv
    42  AddType application/x-httpd-php-source .phps
    43  AddType application/x-pilot .prc .pdb
    44  AddType application/x-shockwave-flash .swf
    45  AddType application/xrds+xml .xrdf
    46  AddType text/plain .ini .sh .bsh .bash .awk .nawk .gawk .csh .var .c .in .h .asc .md5 .sha .sha1
    47  AddType video/x-flv .flv
    48  
    49  # AddEncoding allows you to have certain browsers uncompress information on the fly. Note: Not all browsers support this.
    50  AddEncoding x-compress .Z
    51  AddEncoding x-gzip .gz .tgz
    52  
    53  # DefaultType: the default MIME type the server will use for a document.
    54  DefaultType text/html
    55  
    56  # Optionally add a line containing the server version and virtual host
    57  # name to server-generated pages (error documents, FTP directory
    58  # listings, mod_status and mod_info output etc., but not CGI generated
    59  # documents or custom error documents).
    60  # Set to "EMail" to also include a mailto: link to the ServerAdmin.
    61  # Set to one of:  On | Off | EMail
    62  ServerSignature Off
    63  ## MAIN DEFAULTS
    64  Options +ExecCGI -Indexes
    65  DirectoryIndex index.html index.htm index.php
    66  DefaultLanguage en-US
    67  AddDefaultCharset UTF-8
    68  ServerSignature Off
    69  
    70  ## ENVIRONMENT VARIABLES
    71  SetEnv PHPRC /webroot/includes
    72  SetEnv TZ America/Las_Vegas
    73  
    74  SetEnv SERVER_ADMIN webmaster@askapache.com
    75  
    76  ## MIME TYPES
    77  AddType video/x-flv .flv
    78  AddType application/x-shockwave-flash .swf
    79  AddType image/x-icon .ico
    80  
    81  ## FORCE FILE TO DOWNLOAD INSTEAD OF APPEAR IN BROWSER
    82  # https://www.htaccesselite.com/addtype-addhandler-action-vf6.html
    83  AddType application/octet-stream .mov .mp3 .zip
    84  
    85  ## ERRORDOCUMENTS
    86  # https://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html
    87  ErrorDocument 400 /e400/
    88  ErrorDocument 401 /e401/
    89  ErrorDocument 402 /e402/
    90  ErrorDocument 403 /e403/
    91  ErrorDocument 404 /e404/
    92  
    93  # Handlers be builtin, included in a module, or added with Action directive
    94  # default-handler: default, handles static content (core)
    95  #   send-as-is: Send file with HTTP headers (mod_asis)
    96  #   cgi-script: treat file as CGI script (mod_cgi)
    97  #    imap-file: Parse as an imagemap rule file (mod_imap)
    98  #   server-info: Get server config info (mod_info)
    99  #  server-status: Get server status report (mod_status)
   100  #    type-map: type map file for content negotiation (mod_negotiation)
   101  #  fastcgi-script: treat file as fastcgi script (mod_fastcgi)
   102  #
   103  # https://www.askapache.com/php/custom-phpini-tips-and-tricks/
   104  
   105  ## PARSE AS CGI
   106  AddHandler cgi-script .cgi .pl .spl
   107  
   108  ## RUN PHP AS APACHE MODULE
   109  AddHandler application/x-httpd-php .php .htm
   110  
   111  ## RUN PHP AS CGI
   112  AddHandler php-cgi .php .htm
   113  
   114  ## CGI PHP WRAPPER FOR CUSTOM PHP.INI
   115  AddHandler phpini-cgi .php .htm
   116  Action phpini-cgi /cgi-bin/php5-custom-ini.cgi
   117  
   118  ## FAST-CGI SETUP WITH PHP-CGI WRAPPER FOR CUSTOM PHP.INI
   119  AddHandler fastcgi-script .fcgi
   120  AddHandler php-cgi .php .htm
   121  Action php-cgi /cgi-bin/php5-wrapper.fcgi
   122  
   123  ## CUSTOM PHP CGI BINARY SETUP
   124  AddHandler php-cgi .php .htm
   125  Action php-cgi /cgi-bin/php.cgi
   126  
   127  ## PROCESS SPECIFIC FILETYPES WITH CGI-SCRIPT
   128  Action image/gif /cgi-bin/img-create.cgi
   129  
   130  ## CREATE CUSTOM HANDLER FOR SPECIFIC FILE EXTENSIONS
   131  AddHandler custom-processor .ssp
   132  Action custom-processor /cgi-bin/myprocessor.cgi
   133  
   134  ### HEADER CACHING
   135  # https://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching/
   136  <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$">
   137  Header set Cache-Control "max-age=2592000"
   138  </FilesMatch>
   139  <FilesMatch "\.(js|css|pdf|swf)$">
   140  Header set Cache-Control "max-age=604800"
   141  </FilesMatch>
   142  <FilesMatch "\.(html|htm|txt)$">
   143  Header set Cache-Control "max-age=600"
   144  </FilesMatch>
   145  <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
   146  Header unset Cache-Control
   147  </FilesMatch>
   148  
   149  ## ALTERNATE EXPIRES CACHING
   150  # htaccesselite.com/d/use-htaccess-to-speed-up-your-site-discussion-vt67.html
   151  ExpiresActive On
   152  ExpiresDefault A604800
   153  ExpiresByType image/x-icon A2592000
   154  ExpiresByType application/x-javascript A2592000
   155  ExpiresByType text/css A2592000
   156  ExpiresByType text/html A300
   157  
   158  <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
   159  ExpiresActive Off
   160  </FilesMatch>
   161  
   162  ## META HTTP-EQUIV REPLACEMENTS
   163  <FilesMatch "\.(html|htm|php)$">
   164  Header set imagetoolbar "no"
   165  </FilesMatch>