vermiliondesign/taco_boilerplate_2015_no_symlinks/master/html/.htaccess - Htaccess File

vermiliondesign/taco_boilerplate_2015_no_symlinks/master/html/.htaccess

# fail-safe in case the conf file doesn't have it
Options All -Indexes

RewriteEngine on

# CUSTOM SERVER VARS

# You must use 'HTTP_' as prefix when setting custom vars.
# This a security check on media temple servers
RewriteRule ^ - [E=HTTP_WP_VERSION_FOLDER_NAME:wordpress-4.x.x]
# fail-safe for apache redirects
SetEnvIf REDIRECT_HTTP_WP_VERSION_FOLDER_NAME (.+) HTTP_WP_VERSION_FOLDER_NAME=$1

# IMPORTANT: Do not change the order of the 3 rewrites below
RewriteCond %{SERVER_NAME} !vermilion.com
RewriteRule ^ - [E=HTTP_APP_ENVIRONMENT:prod]

RewriteCond %{SERVER_NAME} (.vermilion.com)
RewriteRule ^ - [E=HTTP_APP_ENVIRONMENT:staging]

RewriteCond %{SERVER_NAME} .dev
RewriteRule ^ - [E=HTTP_APP_ENVIRONMENT:dev]

# fail-safe for apache redirects
SetEnvIf REDIRECT_HTTP_APP_ENVIRONMENT (.+) HTTP_APP_ENVIRONMENT=$1

# WP REWRITES/REDIRECTS

RewriteRule ^xmlrpc.php(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/xmlrpc.php$1 [L,QSA]
RewriteRule ^wp-cron.php(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-cron.php$1 [L,QSA]
RewriteRule ^wp-trackback.php(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-trackback.php$1 [L,QSA]
RewriteRule ^wp-comments-post.php(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-comments-post.php$1 [L,QSA]
RewriteRule ^wp-mail.php(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-mail.php$1 [L,QSA]

RewriteRule ^wp-content(.*) /app/wp-content$1 [L]
RewriteRule ^wp-includes(.*) /%{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-includes$1 [L,QSA]

RewriteRule ^wp-admin(.*) %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-admin$1 [L,QSA]
RewriteRule ^wp-login.php$ /%{ENV:HTTP_WP_VERSION_FOLDER_NAME}/wp-login.php$1 [L,QSA]

RewriteRule ^%{ENV:HTTP_WP_VERSION_FOLDER_NAME}/index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/index.php [L]

RewriteRule ^(/)?$ %{ENV:HTTP_WP_VERSION_FOLDER_NAME}/index.php [L]

# LAZY LOADING IMAGES
RewriteCond %{QUERY_STRING} lazy_bg=true
RewriteCond %{QUERY_STRING} lazy_quality=(.*)
RewriteRule (.*)(.jpg|jpeg|png|gif) app/wp-content/lazy-images/get-image.php?image_file_path=$1$2&lazy_bg=true&lazy_quality=%1 [L]

# DENY ACCESS TO FILES/DIRECTORIES

# If you are going to forbid access to a directory, do something like the below (commented out).
#RewriteRule ^folder_name(.*) - [F,L,NC]

# forbid access to certain files by name
<FilesMatch "(.md|.git|.gitignore|.sql|.sql.gz)">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# OPTIMIZATION
<IfModule mod_headers.c>
  Header unset ETag
  FileETag none
</IfModule>

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

<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType text/x-javascript "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresDefault "access plus 2 days"
</ifModule>

On Github License

Files

Download PDF of Htaccess file
DEFLATE, ENV, HTTP_WP_VERSION_FOLDER_NAME, QUERY_STRING, REQUEST_FILENAME, SERVER_NAME

Comments

Apache