Skip to content

Instantly share code, notes, and snippets.

@andresgutgon
Created February 12, 2011 18:49
Show Gist options
  • Save andresgutgon/823981 to your computer and use it in GitHub Desktop.
Save andresgutgon/823981 to your computer and use it in GitHub Desktop.
Apache RewriteRules
<VirtualHost *:80>
ServerName appname.local
DocumentRoot "/Users/andres/Documents/SOFTWARE/RAILS/App/2/appname/public"
RailsEnv development
<Directory "/Users/andres/Documents/SOFTWARE/RAILS/App/2/appname/public">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
# # #Caching for the index page
RewriteCond %{THE_REQUEST} ^GET
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteRule ^[/]?$ /cache/index.html [L]
RewriteCond %{THE_REQUEST} ^(GET|HEAD)
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^([^.]+[^/])[/]?$
RewriteCond %{DOCUMENT_ROOT}/cache/$1.html -f
RewriteRule ^([^.]+[^/])[/]?$ /cache/$1.html [L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment