Created
September 6, 2012 14:30
-
-
Save dennisreimann/3656874 to your computer and use it in GitHub Desktop.
Uberspace htaccess for Rails apps
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 | |
RewriteBase / | |
# ensure the browser supports gzip encoding | |
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b | |
RewriteCond %{REQUEST_FILENAME}.gz -s | |
RewriteRule ^(.+) $1.gz [L] | |
# ensure correct Content-Type and add encoding header | |
<FilesMatch \.css\.gz$> | |
ForceType text/css | |
Header set Content-Encoding gzip | |
</lesMatch> | |
<FilesMatch \.js\.gz$> | |
ForceType text/javascript | |
Header set Content-Encoding gzip | |
</FilesMatch> | |
# cache assets like forever | |
<FilesMatch \.(js|css|gz|jpe?g|gif|png|ico)$> | |
Header unset ETag | |
FileETag None | |
ExpiresActive On | |
ExpiresDefault "access plus 1 year" | |
</FilesMatch> | |
# maintenance mode | |
ErrorDocument 503 /system/maintenance.html | |
RewriteCond %{REQUEST_URI} !.(css|gif|jpg|png)$ | |
RewriteCond /var/www/virtual/dreimann/rails/openid/current/public/system/maintenance.html -f | |
RewriteCond %{SCRIPT_FILENAME} !maintenance.html | |
RewriteRule ^.*$ - [redirect=503,last] | |
# let rails handle everything else | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ http://localhost:43860/$1 [P] |
test!
This wasnt tested for a long period of time.
https://gist.github.com/dennisreimann/3656874#file-htaccess-L13
This line should probably be </FilesMatch>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test?