Created
September 21, 2014 18:06
-
-
Save brookinsconsulting/a7aecefce2f676979634 to your computer and use it in GitHub Desktop.
Example working virtual host mod_rewrite rules configuration for serving static cache by default. Tested with ezpublish5_community_project-2014.07.0-gpl-full
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
#RewriteLog "/tmp/rewrite.log" | |
#RewriteLogLevel 5 | |
# | |
# Static cache in eZ Publish | |
# | |
# 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.*$ | |
#RewriteCond %{REMOTE_ADDR} !^::1$ | |
# Do not cache server based request | |
RewriteCond %{HTTP_USER_AGENT} !^eZ\ Publish\ static\ cache\ generator$ | |
# Redirect home page requests to static default siteaccess cache | |
RewriteCond %{QUERY_STRING} ^$ | |
RewriteCond %{DOCUMENT_ROOT}/var/ezwebin_site/static/ezecosystem/index\.html -f | |
RewriteRule ^/?$ %{DOCUMENT_ROOT}/var/ezwebin_site/static/ezecosystem/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.*$ | |
# Do not cache server based request | |
RewriteCond %{HTTP_USER_AGENT} !^eZ\ Publish\ static\ cache\ generator$ | |
# Redirect all other page requests to static default siteaccess cache | |
# Does the index.html exist in the static cache? | |
RewriteCond %{DOCUMENT_ROOT}/var/ezwebin_site/static/ezecosystem$1/index.html -f | |
# Rewrite to the static cache | |
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/var/ezwebin_site/static/ezecosystem$1/index.html [L] | |
# Default ezpublish rules go after this comment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment