Htaccess File


# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE

# Disable html pragma meta commands use HTACCESS instead
Header unset Pragma

# Let browser rely on Cashe Control Headers
FileETag None
Header unset ETag

# cache images/pdf docs for 1 yearish ,public, must-revalidate
<FilesMatch ".(ico|pdf|jpg|jpeg|png|gif)$">
  Header set Cache-Control "max-age=29030400, public"
#  Header unset Last-Modified

# cache html/htm/xml/txt diles for 2 days
<FilesMatch ".(html|htm|xml|txt|xsl)$">
  Header set Cache-Control "max-age=172800, must-revalidate"

# Force no caching for dynamic files
<FilesMatch ".(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"

# Turn on rewrites.
RewriteEngine on

# Only apply to URLs on this domain
#RewriteCond %{HTTP_HOST} ^(www.)?$

# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/public/

# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ public/index.php?params=$1

# Also redirect the root folder.
#RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ public/index.php?params=$1 [L]
Exit mobile version