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

     1  # This .htaccess file is used to speed up this website
     2  # See https://github.com/sergeychernyshev/.htaccess
     3  
     4  
     5  # ----------------------------------------------------------------------
     6  # Proper MIME type for all files
     7  #
     8  # Copied from the HTML5 boilerplate project's .htaccess file
     9  # https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
    10  # ----------------------------------------------------------------------
    11  
    12  # JavaScript
    13  #   Normalize to standard type (it's sniffed in IE anyways)
    14  #   tools.ietf.org/html/rfc4329#section-7.2
    15  AddType	application/javascript			js jsonp
    16  AddType	application/json			json
    17  
    18  # Audio
    19  AddType	audio/ogg				oga ogg
    20  AddType	audio/mp4				m4a f4a f4b
    21  
    22  # Video
    23  AddType	video/ogg				ogv
    24  AddType	video/mp4				mp4 m4v f4v f4p
    25  AddType	video/webm				webm
    26  AddType	video/x-flv				flv
    27  
    28  # SVG
    29  #   Required for svg webfonts on iPad
    30  #   twitter.com/FontSquirrel/status/14855840545
    31  AddType		image/svg+xml			svg svgz
    32  AddEncoding	gzip				svgz
    33  
    34  # Webfonts
    35  AddType application/vnd.ms-fontobject		eot
    36  AddType application/x-font-ttf			ttf ttc
    37  AddType font/opentype				otf
    38  AddType application/x-font-woff			woff
    39  
    40  # Assorted types
    41  AddType	image/x-icon				ico
    42  AddType	image/webp				webp
    43  AddType	text/cache-manifest			appcache manifest
    44  AddType	text/x-component			htc
    45  AddType	application/xml				rss atom xml rdf
    46  AddType	application/x-chrome-extension		crx
    47  AddType	application/x-opera-extension		oex
    48  AddType	application/x-xpinstall			xpi
    49  AddType	application/octet-stream		safariextz
    50  AddType	application/x-web-app-manifest+json	webapp
    51  AddType	text/x-vcard				vcf
    52  AddType	application/x-shockwave-flash		swf
    53  AddType	text/vtt				vtt
    54  
    55  # --------------------------------------------------------------------------------------
    56  # Compression: http://code.google.com/speed/page-speed/docs/payload.html#GzipCompression
    57  # --------------------------------------------------------------------------------------
    58  <IfModule mod_deflate.c>
    59  	AddOutputFilterByType DEFLATE application/atom+xml
    60  	AddOutputFilterByType DEFLATE application/json
    61  	AddOutputFilterByType DEFLATE application/xhtml+xml
    62  	AddOutputFilterByType DEFLATE application/xml
    63  	AddOutputFilterByType DEFLATE text/css
    64  	AddOutputFilterByType DEFLATE text/html
    65  	AddOutputFilterByType DEFLATE text/plain
    66  	AddOutputFilterByType DEFLATE text/x-component
    67  	AddOutputFilterByType DEFLATE text/xml
    68  	
    69  	# The following MIME types are in the process of registration
    70  	AddOutputFilterByType DEFLATE application/xslt+xml
    71  	AddOutputFilterByType DEFLATE image/svg+xml
    72  	
    73  	# The following MIME types are NOT registered
    74  	AddOutputFilterByType DEFLATE application/mathml+xml
    75  	AddOutputFilterByType DEFLATE application/rss+xml
    76  	
    77  	# JavaScript has various MIME types
    78  	AddOutputFilterByType DEFLATE application/javascript
    79  	AddOutputFilterByType DEFLATE application/x-javascript
    80  	AddOutputFilterByType DEFLATE text/ecmascript
    81  	AddOutputFilterByType DEFLATE text/javascript
    82  
    83  	# .ico files and other compressible images
    84  	AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
    85  	AddOutputFilterByType DEFLATE image/x-icon
    86  	AddOutputFilterByType DEFLATE image/bmp
    87  	AddOutputFilterByType DEFLATE image/tiff
    88  	AddOutputFilterByType DEFLATE application/pdf
    89  
    90  	# compressible fonts (.woff is already compressed)
    91  	AddOutputFilterByType DEFLATE font/opentype
    92  	AddOutputFilterByType DEFLATE application/x-font-ttf
    93  	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    94  </IfModule>
    95  
    96  # ----------------------------------------------------------------------
    97  # Enabling filename rewriting (file.XXX.ext) if URL rewriting is enabled
    98  # Otherwise URLs will use query strings (file.ext?v=XXX)
    99  #
   100  # More proxies cache assets if there is no query string
   101  # ----------------------------------------------------------------------
   102  <IfModule mod_rewrite.c>
   103  	RewriteEngine On
   104  
   105  	# Setting up an environment variable so your code can detect if mod_rewrite rules are executable
   106  	# in this folder and you can use file.123.jpg or you need to fall back to file.jpg?123
   107  	RewriteRule .					-	[E=URLVERSIONREWRITE:YES]
   108  
   109  	# Rewrites a version in file.123.jpg as well as timestamped version file.123_m_12345123512354.jpg
   110  	# to original file.jpg so you can use it instead of file.jpg?123 which isn't cached in some proxies.
   111  	RewriteCond %{REQUEST_FILENAME}			!-f
   112  	RewriteRule ^(.*)\.(\d+)(_m_\d+)?\.([^\.]+)$	$1.$4	[L,QSA]
   113  
   114  	# Rewrites a version in file.ac123fe.jpg to original file.jpg
   115  	# so you can use it instead of file.jpg?123 which isn't cached in some proxies.
   116  	# Used for hash-based URLs where having a timestamp is not necessary.
   117  	RewriteCond %{REQUEST_FILENAME}			!-f
   118  	RewriteRule ^(.*)\.([a-z\d]+)\.([^\.]+)$	$1.$3	[L,QSA]
   119  </IfModule>
   120  
   121  # -------------------------------------------------------------------------------------------------
   122  # Browser Caching: http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching
   123  #
   124  # Google recommends specifying the following for all cacheable resources:
   125  #
   126  #    1. Expires or Cache-Control max-age
   127  #
   128  # 	Set Expires to a minimum of one month, and preferably up to one year, in the future. (We
   129  # 	prefer Expires over Cache-Control: max-age because it is is more widely supported.) Do not
   130  # 	set it to more than one year in the future, as that violates the RFC guidelines.
   131  #
   132  #    2. Last-Modified or ETag
   133  #
   134  # 	Set the Last-Modified date to the last time the resource was changed. If the Last-Modified
   135  #	date is sufficiently far enough in the past, chances are the browser won't refetch it. 
   136  #
   137  # Per Google: "it is redundant to specify both Expires and Cache-Control: max-age, or to specify
   138  # both Last-Modified and ETag."
   139  # --------------------------------------------------------------------------------------------------
   140  <IfModule mod_expires.c>
   141  	ExpiresActive On
   142  
   143  	ExpiresByType application/json			"access plus 1 year"
   144  	ExpiresByType application/pdf			"access plus 1 year"
   145  	ExpiresByType application/x-shockwave-flash	"access plus 1 year"
   146  	ExpiresByType image/bmp 			"access plus 1 year"
   147  	ExpiresByType image/gif 			"access plus 1 year"
   148  	ExpiresByType image/jpeg 			"access plus 1 year"
   149  	ExpiresByType image/png 			"access plus 1 year"
   150  	ExpiresByType image/svg+xml 			"access plus 1 year"
   151  	ExpiresByType image/tiff 			"access plus 1 year"
   152  	ExpiresByType image/vnd.microsoft.icon 		"access plus 1 year"
   153    	ExpiresByType image/x-icon			"access plus 1 year"
   154  	ExpiresByType text/css 				"access plus 1 year"
   155  	ExpiresByType video/x-flv 			"access plus 1 year"
   156  	ExpiresByType application/vnd.bw-fontobject	"access plus 1 year"
   157  	ExpiresByType application/x-font-ttf		"access plus 1 year"
   158  	ExpiresByType application/font-woff		"access plus 1 year"
   159  	ExpiresByType font/opentype			"access plus 1 year"
   160  	ExpiresByType image/webp			"access plus 1 year"
   161  
   162  	# The following MIME types are in the process of registration
   163  	ExpiresByType application/xslt+xml		"access plus 1 year"
   164  	ExpiresByType image/svg+xml			"access plus 1 year"
   165  
   166  	# The following MIME types are NOT registered
   167  	ExpiresByType application/mathml+xml		"access plus 1 year"
   168  	ExpiresByType application/rss+xml		"access plus 1 year"
   169  
   170  	# JavaScript has various MIME types
   171  	ExpiresByType application/x-javascript 		"access plus 1 year"
   172  	ExpiresByType application/javascript 		"access plus 1 year"
   173  	ExpiresByType text/ecmascript 			"access plus 1 year"
   174  	ExpiresByType text/javascript 			"access plus 1 year"
   175  </IfModule>
   176  
   177  # TODO: Set Last-Modified per Google's recommendation to complete browser caching
   178  
   179  # -------------------------------------------------------------------------
   180  # Disabling ETags as they are most likely misconfigured and
   181  # do not add functionalit beyond Last-Modified
   182  # -------------------------------------------------------------------------
   183  <IfModule mod_headers.c>
   184  	# Try removing etag headers (it's coming from proxy for example)
   185  	Header unset ETag
   186  </IfModule>
   187  
   188  # Remove ETags
   189  FileETag None