diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-15 13:22:58 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-15 13:22:58 +0000 |
commit | c755b29a862c7da91f30a7c68ac98cfdc79cfbf5 (patch) | |
tree | e602f75aa56a6a076f1d4a3657e143e49c706a1c /railties/configs | |
parent | 4a0695996f78c6fd330f1961d450367fc8fa5406 (diff) | |
download | rails-c755b29a862c7da91f30a7c68ac98cfdc79cfbf5.tar.gz rails-c755b29a862c7da91f30a7c68ac98cfdc79cfbf5.tar.bz2 rails-c755b29a862c7da91f30a7c68ac98cfdc79cfbf5.zip |
Fixed page caching problems with saving cached file fails for the index action and that it shouldnt cache files with GET/POST parameters #462
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@407 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/configs')
-rwxr-xr-x | railties/configs/apache.conf | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/railties/configs/apache.conf b/railties/configs/apache.conf index 592c7ef155..5548292f8d 100755 --- a/railties/configs/apache.conf +++ b/railties/configs/apache.conf @@ -12,22 +12,48 @@ RewriteBase /dispatch.cgi # Enable this rewrite rule to point to the controller/action that should serve root. # RewriteRule ^$ /controller/action [R] +# <caching> +# no query string? +RewriteCond %{QUERY_STRING} ^$ + +# no POST method? +RewriteCond %{REQUEST_METHOD} !^POST$ [NC] + +# Request filename is a directory? +RewriteCond %{REQUEST_FILENAME} -d + +# Request filename + '/index' is a file? +RewriteCond %{REQUEST_FILENAME}/index -f + +# Rewrite to request filename + '/index' and finish +RewriteRule ^(.*)/?$ $1/index [QSA,L] + +# no query string? +RewriteCond %{QUERY_STRING} ^$ + +# no POST method? +RewriteCond %{REQUEST_METHOD} !^POST$ [NC] + +# Request filename is a file? +RewriteCond %{REQUEST_FILENAME} -f + +# Finish rewriting +RewriteRule .* - [L] + +# Set default type of cached files to text/html +DefaultType text/html +# </caching> + # Add missing slash RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R] # Default rewriting rules. -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?controller=$1&action=$2&id=$3 [QSA,L] -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?controller=$1&action=$2 [QSA,L] -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/$ ?controller=$1&action=index [QSA,L] -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?module=$1&controller=$2&action=$3&id=$4 [QSA,L] -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?module=$1&controller=$2&action=$3 [QSA,L] -RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/$ ?module=$1&controller=$2&action=index [QSA,L] # You can also point these error messages to a controller/action |