noslouch/pa/master/.htaccess - Htaccess File

noslouch/pa/master/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On

    #------------------- remove trailing slash -------------------
    RewriteCond %{REQUEST_URI} !^/core [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)/$ /$1 [R=301,L,QSA]

    #------------------- index.php -------------------
    #strip index.php from the URL if that is all that is given
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /([^/]+/)*index.php HTTP/
    RewriteRule ^(([^/]+/)*)index.php$ http://%{HTTP_HOST}/ [R=301,NS,L,QSA]
    #strip index.php/* from the URL
    RewriteCond %{THE_REQUEST} ^[^/]*/index.php/ [NC]
    RewriteRule ^index.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]

    #------------------- CE Cache Static Driver -------------------
    RewriteCond %{REQUEST_URI} !^/core [NC]
    RewriteCond %{QUERY_STRING} !ACT|URL [NC]
    RewriteCond %{REQUEST_METHOD} !=POST [NC]
    RewriteCond %{DOCUMENT_ROOT}/static/ce_cache/29174f/static%{REQUEST_URI}/index.html -f [NC]
    RewriteRule (.*) /_static_cache_handler.php%{REQUEST_URI}/index.html [L,QSA]

    #------------------- EE -------------------
    #rewrite all non-image/js/css urls back to index.php if they are not files or directories
    RewriteCond $1 !.(css|js|gif|jpe?g|png) [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

    #------------------- Cache-Busting -------------------
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+).(d+).(js|css|png|jpg|gif)$ $1.$3 [L]

    #------------------- CMS rewrite -------------------
    RewriteRule cms$ http://%{HTTP_HOST}/admin.php [R=301,L]
</IfModule>

#<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteCond $1 !.(gif|jpe?g|png)$ [NC]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /index.php/$1 [L]
#</IfModule>               

Options +FollowSymlinks

ErrorDocument 404 /index.php/404/index

<FilesMatch "(.jpe?g|gif|png|bmp|css|js|flv)$">
  ErrorDocument 404 "File Not Found"
</FilesMatch>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
</IfModule>

<IfModule mod_rewrite.c>
  RewriteRule "(^|/)." - [F]
</IfModule>

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>

<IfModule mod_deflate.c>

  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)s*,?s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    </IfModule>
  </IfModule>

  # Compress all output labeled with one of the following MIME-types
  # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
  # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines as
  # `AddOutputFilterByType` is still in the core directives)
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml 
                                  application/javascript 
                                  application/json 
                                  application/rss+xml 
                                  application/vnd.ms-fontobject 
                                  application/x-font-ttf 
                                  application/xhtml+xml 
                                  application/xml 
                                  font/opentype 
                                  image/svg+xml 
                                  image/x-icon 
                                  text/css 
                                  text/html 
                                  text/plain 
                                  text/x-component 
                                  text/xml
  </IfModule>

</IfModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, DOCUMENT_ROOT, HTTP_HOST, HTTPS, POST, QUERY_STRING, REQUEST_FILENAME, REQUEST_METHOD, REQUEST_URI, static, THE_REQUEST

Comments

Apache