aboutsummaryrefslogtreecommitdiffstats
path: root/railties/configs/apache.conf
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-15 01:24:55 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-15 01:24:55 +0000
commit88a3343ed57c01ca358da8473d15fc4d2b4a5bff (patch)
tree3fe773bb113480f68eaea508d241cbaf90eebfde /railties/configs/apache.conf
parent60f7a5cab73fab032fdb73d1a9a8061cf20031d2 (diff)
downloadrails-88a3343ed57c01ca358da8473d15fc4d2b4a5bff.tar.gz
rails-88a3343ed57c01ca358da8473d15fc4d2b4a5bff.tar.bz2
rails-88a3343ed57c01ca358da8473d15fc4d2b4a5bff.zip
Backed out of routing merge.. investigating missing patches
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@616 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/configs/apache.conf')
-rwxr-xr-xrailties/configs/apache.conf59
1 files changed, 57 insertions, 2 deletions
diff --git a/railties/configs/apache.conf b/railties/configs/apache.conf
index 1aa874c866..5548292f8d 100755
--- a/railties/configs/apache.conf
+++ b/railties/configs/apache.conf
@@ -1,6 +1,61 @@
+# General Apache options
+AddHandler fastcgi-script .fcgi
+AddHandler cgi-script .cgi
+Options +FollowSymLinks +ExecCGI
+
+# Make sure that mod_ruby.c has been added and loaded as a module with Apache
RewriteEngine On
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L]
+# Change extension from .cgi to .fcgi to switch to FCGI and to .rb to switch to mod_ruby
+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.
+RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?controller=$1&action=$2&id=$3 [QSA,L]
+RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?controller=$1&action=$2 [QSA,L]
+RewriteRule ^([-_a-zA-Z0-9]+)/$ ?controller=$1&action=index [QSA,L]
+
+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]
+RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?module=$1&controller=$2&action=$3 [QSA,L]
+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
ErrorDocument 500 /500.html
ErrorDocument 404 /404.html \ No newline at end of file