mecha-cms/mecha-cms/master/.htaccess - Htaccess File


# Set default charset utf-8
AddDefaultCharset UTF-8

# Block access to directories without a default document.
# You should leave the following uncommented, as you shouldn't allow anyone to
# surf through every directory on your server (which may includes rather private
# places such as the CMS's directories).
<IfModule mod_autoindex.c>
    Options -Indexes

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
    php_flag magic_quotes_gpc off
    php_flag magic_quotes_sybase off
    php_flag register_globals off

# Force Internet Explorer to render pages in the highest available mode
# in the various cases when it may not.
<IfModule mod_headers.c>
    Header set X-UA-Compatible "IE=edge"
    # `mod_headers` cannot match based on the content-type, however, this
    # header should be send only for HTML pages and not for the other resources
    <FilesMatch ".(appcache|atom|crx|css|cur|eot|f4[abpv]|flv|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|tt[cf]|vcf|vtt|webapp|web[mp]|woff|xml|xpi)$">
        Header unset X-UA-Compatible

# Prevent viewing of .htaccess file
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
    Satisfy all

# gzip
<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(archive|cache|css|eot|hold|html?|js|jsonp?|md|php|pl|ttf|txt|xml)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude file .woff2?$
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

# The following expires headers are set pretty far in the future. If you
# don't control versioning with filename-based cache busting, consider
# lowering the cache time for resources such as style sheets and JavaScript
# files to something like one week.
<IfModule mod_expires.c>

    ExpiresActive on
    ExpiresDefault "access plus 1 month"

  # CSS
    ExpiresByType text/css "access plus 1 year"

  # Data interchange
    ExpiresByType application/json "access plus 0 seconds"
    ExpiresByType application/ld+json "access plus 0 seconds"
    ExpiresByType application/xml "access plus 0 seconds"
    ExpiresByType text/xml "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/x-icon "access plus 1 week"

  # HTML components (HTCs)
    ExpiresByType text/x-component "access plus 1 month"

  # HTML
    ExpiresByType text/html "access plus 0 seconds"

  # JavaScript
    ExpiresByType application/javascript "access plus 1 year"

  # Manifest files
    ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
    ExpiresByType text/cache-manifest "access plus 0 seconds"

  # Media
    ExpiresByType audio/ogg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType video/mp4 "access plus 1 month"
    ExpiresByType video/ogg "access plus 1 month"
    ExpiresByType video/webm "access plus 1 month"

  # Web feeds
    ExpiresByType application/atom+xml "access plus 1 hour"
    ExpiresByType application/rss+xml "access plus 1 hour"

  # Web fonts
    ExpiresByType application/font-woff "access plus 10 year"
    ExpiresByType application/ "access plus 10 year"
    ExpiresByType application/x-font-woff "access plus 10 year"
    ExpiresByType application/x-font-ttf "access plus 10 year"
    ExpiresByType font/opentype "access plus 10 year"
    ExpiresByType image/svg+xml "access plus 10 year"


<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L,QSA]

On Github License


Download PDF of Htaccess file