CatherinePhung/statedecoded/master/htdocs/.htaccess - Htaccess File

CatherinePhung/statedecoded/master/htdocs/.htaccess

# Specify our error pages.
ErrorDocument 404 /404.php

# Apache often fails to serve SVGs properly.
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

<IfModule mod_env.c>
   SetEnv HTTP_MOD_ENV on
</ifModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Append a trailing slash to URLs. Don't try to append trailing slashes to static assets or, if
# mod_pagespeed is running, to its own in-memory repository.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_URI} !.json|.xml|.txt$
RewriteCond %{REQUEST_URI} !themes/(.+)/static/(.+)$
RewriteCond %{REQUEST_URI} !mod_pagespeed_static/(.+)$
RewriteRule ^(.*)$ /$1/ [L,R=301]

# If this is a request for a plain-text version of a page, translate the extention into a specific
# request.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/downloads/current/code-text%{REQUEST_URI} -f
RewriteRule ^(.*.txt)$ /downloads/current/code-text/$1 [L]

# If this is a request for the JSON version of a law, remap the extension to the cached JSON file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/downloads/current/code-json%{REQUEST_URI} -f
RewriteRule ^(.*.json)$ /downloads/current/code-json/$1 [L]

# If this is a request for the XML version of a law, remap the extension to the cached XML file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/downloads/current/code-xml%{REQUEST_URI} -f
RewriteRule ^(.*.xml)$ /downloads/current/code-xml/$1 [L]

RewriteRule ^index.php$ - [L]

RewriteRule ^admin/ /index.php [L]

RewriteCond %{REQUEST_URI} !/downloads/(.+)/ [NC]
RewriteRule ^downloads/ /index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

On Github License

Files

Download PDF of Htaccess file
DOCUMENT_ROOT, ENV, REQUEST_FILENAME, REQUEST_URI, static

Comments

Apache