<IfModule mod_rewrite.c>
RewriteEngine on

#
# Uncomment the statement below if URL rewriting doesn't
# work properly. If you installed phpBB in a subdirectory
# of your site, properly set the argument for the statement.
# e.g.: if your domain is test.com and you installed phpBB
# in http://www.test.com/phpBB/index.php you have to set
# the statement RewriteBase /phpBB/
#
#RewriteBase /

#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

#
# The following 3 lines will rewrite URLs passed through the front controller
# to not require app.php in the actual URL. In other words, a controller is
# by default accessed at /app.php/my/controller, but can also be accessed at
# /my/controller
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]

#
# If symbolic links are not already being followed,
# uncomment the line below.
# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
#
#Options +FollowSymLinks
</IfModule>

# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
	<IfVersion < 2.4>
		<Files "config.php">
			Order Allow,Deny
			Deny from All
		</Files>
		<Files "common.php">
			Order Allow,Deny
			Deny from All
		</Files>
	</IfVersion>
	<IfVersion >= 2.4>
		<Files "config.php">
			Require all denied
		</Files>
		<Files "common.php">
			Require all denied
		</Files>
	</IfVersion>
</IfModule>
<IfModule !mod_version.c>
	<IfModule !mod_authz_core.c>
		<Files "config.php">
			Order Allow,Deny
			Deny from All
		</Files>
		<Files "common.php">
			Order Allow,Deny
			Deny from All
		</Files>
	</IfModule>
	<IfModule mod_authz_core.c>
		<Files "config.php">
			Require all denied
		</Files>
		<Files "common.php">
			Require all denied
		</Files>
	</IfModule>
</IfModule>

# Common
AddDefaultCharset utf-8
AddCharset utf-8 .html .css .js .xml .json .rss
Options -Indexes
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag register_globals off
</IfModule>
FileETag None

<IfModule mod_expires.c>
ExpiresActive On
</IfModule>

# Multimedia MIME types
AddType audio/ogg						ogg oga
AddType video/ogg						ogv
AddType audio/webm						webma
AddType video/webm						webm webmv
AddType audio/mp4						m4a
AddType video/mp4						mp4 m4v
AddType audio/opus						opus
AddType audio/flac						flac
AddType audio/aac						aac
AddType audio/mpeg						mp1 mp2 mp3 mpg mpeg
AddType audio/wav						wav

<IfModule mod_expires.c>
ExpiresByType audio/ogg					"access plus 3 month"
ExpiresByType video/ogg					"access plus 3 month"
ExpiresByType audio/webm				"access plus 3 month"
ExpiresByType video/webm				"access plus 3 month"
ExpiresByType audio/mp4					"access plus 3 month"
ExpiresByType video/mp4					"access plus 3 month"
ExpiresByType audio/opus				"access plus 3 month"
ExpiresByType audio/flac				"access plus 3 month"
ExpiresByType audio/aac					"access plus 3 month"
ExpiresByType audio/mpeg				"access plus 3 month"
ExpiresByType audio/wav					"access plus 3 month"
</IfModule>

# Image MIME types
AddType image/png						png
AddType image/gif						gif
AddType image/jpeg						jpg jpeg
AddType image/webp						webp
AddType image/svg+xml					svg svgz

<IfModule mod_expires.c>
ExpiresByType image/png					"access plus 1 month"
ExpiresByType image/gif					"access plus 1 month"
ExpiresByType image/jpeg				"access plus 1 month"
ExpiresByType image/webp				"access plus 1 month"
ExpiresByType image/svg+xml				"access plus 1 month"
</IfModule>

# Font MIME types
AddType font/ttf						ttf
AddType font/otf						otf
AddType application/x-font-woff			woff

<IfModule mod_expires.c>
ExpiresByType font/ttf					"access plus 1 month"
ExpiresByType font/otf					"access plus 1 month"
ExpiresByType application/x-font-woff	"access plus 1 month"
</IfModule>

# Text MIME types
AddType text/cache-manifest				manifest
AddType text/javascript					js
AddType text/css						css
AddType text/html						html
AddType text/plain						txt log csv tsv

<IfModule mod_expires.c>
ExpiresByType text/cache-manifest		"access plus 7 days"
ExpiresByType application/javascript	"access plus 7 days"
ExpiresByType application/x-javascript	"access plus 7 days"
ExpiresByType text/javascript			"access plus 7 days"
ExpiresByType text/css					"access plus 7 days"
ExpiresByType text/html					"access plus 7 days"
</IfModule>

# Binary MIME types
AddType application/x-7z-compressed		7z
AddType application/x-shockwave-flash	swf

<IfModule mod_expires.c>
ExpiresByType application/x-7z-compressed	"access plus 1 month"
ExpiresByType application/x-shockwave-flash	"access plus 1 month"
</IfModule>

# Gzip compression for Apache 2
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
</IfModule>
</IfModule>

# Gzip compression for Apache 1
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php)$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
