Skip to content

Instantly share code, notes, and snippets.

@isaac
Created February 9, 2009 01:23
Show Gist options
  • Save isaac/60596 to your computer and use it in GitHub Desktop.
Save isaac/60596 to your computer and use it in GitHub Desktop.
# Don't cause the server to break if Passenger module not loaded
<IfModule passenger_module>
<VirtualHost _default_:80>
DocumentRoot "/opt/apps/mephisto/current/public"
RailsEnv production
# RailsAllowModRewrite off
#
# Check for maintenance file and redirect all requests
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/assets/.*$
RewriteRule ^/assets/(.*)$ /assets/%{HTTP_HOST}/$1 [QSA,L]
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/index.html -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}/index.html [QSA,L]
RewriteCond %{REQUEST_URI} ^/[^.]+$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html [QSA,L]
RewriteCond %{REQUEST_URI} ^/.+$
RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME} -f
RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME} [QSA,L]
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
<Directory "/opt/apps/mephisto/current/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment