Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brookinsconsulting/768cab49180dcc2c4a7d to your computer and use it in GitHub Desktop.
Save brookinsconsulting/768cab49180dcc2c4a7d to your computer and use it in GitHub Desktop.
Example working .htaccess configuration file configured for serving static cache by default. Tested with ezpublish5_community_project-2014.07.0-gpl-full
# Copy this file to a new file called .htaccess in your eZ Publish root
# to secure your installation by turning on .htaccess based virtual host mode.
DirectoryIndex index.php
RewriteEngine On
#
# Static cache in eZ Publish
#
# Skip processing for static siteaccess page views
RewriteRule ^var/ezwebin_site/static/.* - [L]
# Redirect home page requests to static default siteaccess cache
RewriteRule ^(/|)$ /var/ezwebin_site/static/en/index\.html [L]
# No cache for http posts
RewriteCond %{REQUEST_METHOD} !^POST$
# Do not cache vhost admin
RewriteCond %{HTTP_HOST} !^admin.*$
# Non caching vhost for passing the static cache
RewriteCond %{HTTP_HOST} !^nocache\.ezpedia\.org$
# Does the index.html exist in the static cache?
RewriteCond /Users/bc/web/ezpedia/ymc/ezpedia/ezp/ezpublish_legacy/var/ezwebin_site/static/$1/index.html -f
# Rewrite to the static cache
RewriteRule ^(.*)$ /var/ezwebin_site/static/$1/index.html [L]
# Default ezpublish rules
RewriteRule ^api/ index_rest.php [L]
RewriteRule ^index_rest\.php - [L]
RewriteRule ^([^/]+/)?content/treemenu.* index_treemenu.php [L]
RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^design/[^/]+/(stylesheets|images|fonts|javascript)/.* - [L]
RewriteRule ^share/icons/.* - [L]
RewriteRule ^extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^var/storage/packages/.* - [L]
# Makes it possible to placed your favicon at the root of your
# eZ Publish instance. It will then be served directly.
RewriteRule ^favicon\.ico - [L]
# Uncomment the line below if you want you favicon be served from the standard design.
# You can customize the path to favicon.ico by replacing design/standard/images/favicon.ico
# by the adequate path.
#RewriteRule ^favicon\.ico /design/standard/images/favicon.ico [L]
RewriteRule ^design/standard/images/favicon\.ico - [L]
# Give direct access to robots.txt for use by crawlers (Google, Bing, Spammers..)
RewriteRule ^robots\.txt - [L]
# eZpedia Mirror Download Folder
RewriteRule ^download - [L]
# Uncomment the following lines when using popup style debug.
# RewriteRule ^var/cache/debug\.html.* - [L]
# RewriteRule ^var/[^/]+/cache/debug\.html.* - [L]
# Platform for Privacy Preferences Project ( P3P ) related files for Internet Explorer
# More info here : http://en.wikipedia.org/wiki/P3p
RewriteRule ^w3c/p3p\.xml - [L]
RewriteRule .* index.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment