# SEO settings
# to work correctly, you need +FollowSymLinks or at least +SymLinksIfOwnerMatch enabled.
# if you get an ERROR 500, try ifownermatch (slower) and/or ask you webhoster to enable mod_rewrite + symlinks

#Options +FollowSymlinks
#Options +SymlinksIfOwnerMatch
DirectoryIndex setup.php
#DirectoryIndex index.php
Order allow,deny
Allow from all

# custom error page
#ErrorDocument 404 http://raspi/web/clone/content/errors/404.html

# SEO settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} /(.*).html
# rewrite all .html files to index.php?include={filename}
RewriteRule ^(.*).html$ \index.php?include=$1 [NC,L]
# rewrite all .htm files to index.php?include={filename}
# if you wish to use tinymce, you need put a # in front of the next line
RewriteRule ^(.*).htm$ \index.php?include=$1 [NC,L]
# Allow Robots.txt to pass through
RewriteRule ^robots.txt - [L]
# Userpage Rewrite Rule
RewriteRule ^welcome/([^/]*)$ \index.php?signup=1 [NC,L]
RewriteRule ^users/([^/]*)$ \index.php?user=$1 [NC,L]
RewriteRule ^users([^/]*)$ \index.php?user=$1 [NC,L]
# Rewrite .html - no extension needed e.g. you can use http://www.yoursite/gallery instead of /gallery.html
RewriteRule ^([^\.]+)$ $1.html [NC,L]
# any other plugin...
# RewriteRule ^plugin([^/]*)$ \index.php?plugin=$1 [L]

# CACHE + THREAD SETTINGS
 <ifModule mod_headers.c>
    Header set Connection keep-alive
 </ifModule>

# CACHE - STATIC CONTENT CACHING starts here
# required modules:
#   mod_expires.so
#   mod.gzip.c
#   mod.deflate.c
# if caching does not work, or you get 500 - server error, check if the required module are loaded.
# in your httpd.conf look for the following line:
# #LoadModule expires_module modules/mod_expires.so -- uncomment it & restart server.
# if you cannot load the modules, comment out all lines til #END CACHING -- and it will work (w/o caching)
 <IfModule mod_expires.c>
    # Add correct content-type for fonts
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg

    #enable cache
    ExpiresActive On

    # default expire 1 day
    ExpiresDefault A86400
    ExpiresByType image/x-icon A2592000
    ExpiresByType application/x-javascript A1209600
    ExpiresByType text/css A1209600
    ExpiresByType image/gif A1209600
    ExpiresByType image/png A1209600
    ExpiresByType image/jpg A1209600
    ExpiresByType image/jpeg A1209600
    ExpiresByType text/plain A86400
    ExpiresByType application/x-shockwave-flash A2592000
    ExpiresByType video/x-flv A2592000
    ExpiresByType application/pdf A2592000
    ExpiresByType application/javascript A2592000
    ExpiresByType text/html A86400
    # Add a far future Expires header for fonts
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType application/x-font-ttf "access plus 1 year"
    ExpiresByType application/x-font-opentype "access plus 1 year"
    ExpiresByType application/x-font-woff "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"

    ## Set up caching on media files for 1 month
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|swf)$">
      ExpiresDefault A2592000
      Header append Cache-Control "public"
    </FilesMatch>

    ## Set up caching on images css and js files for 2 weeks
    <FilesMatch "\.(gif|jpg|jpeg|png|js|css)$">
      ExpiresDefault A1209600
      Header append Cache-Control "public"
    </FilesMatch>

    ## Set up 1 day caching on commonly updated files
    <FilesMatch "\.(xml|txt|htm|html)$">
      ExpiresDefault A86400
      Header append Cache-Control "private, must-revalidate"
    </FilesMatch>

    ## Force no caching for dynamic files
    <FilesMatch "\.(php|cgi|pl|ini)$">
      ExpiresDefault A0
      Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
      Header set Pragma "no-cache"
    </FilesMatch>
</IfModule>

# BEGIN GZIP
# compress the output of html, xml, txt, css and js files
# mod_gzip compression (legacy, Apache 1.3)
<IfModule mod_gzip.c>
 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file \.(html?|xml|txt|css|js)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
 # END GZIP

 # DEFLATE compression
 # this deflates all zipped files
 <IfModule mod_deflate.so>
 # Set compression for: html,txt,xml,js,css,svg and otf, ttf and woff fonts
 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/xml application/xhtml+xml application/x-javascript application/x-font-ttf application/x-font-opentype image/svg+xml
 # Deactivate compression for buggy browsers
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4.0[678] no-gzip
 BrowserMatch bMSIE !no-gzip !gzip-only-text/html
 # Set header information for proxies
 Header append Vary User-Agent
</IfModule>
 # END DEFLATE
# END CACHING ############################################

# override max post size
# php_value post_max_size 32M

# override max upload file size
# php_value upload_max_filesize 32M

