DirectoryIndex index.php
Options -MultiViews -Indexes +FollowSymLinks

# For Apache2 without rewrites, so /index.php/foobar works.
AcceptPathInfo On
# Make sure Apache2 doesn't redirect requests to existing directory names so they contain a trailing slash (kind of messes up the rewrites)
DirectorySlash Off

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase %%PUBLIC_BASE%%
	
	# Special rule for calls to index.php so it can't be called directly, also prevents an infinite loop.
	# Redirect target *must* be "./index.php" or else mod_rewrite thinks the URL is the same and skips.
	# The check on REDIRECT_STATUS makes sure it's a direct request and not an internal redirect.
	# "NC" flag is for case insensitivity on OS X and Windows.
	RewriteCond %{ENV:REDIRECT_STATUS} ^$
	RewriteRule ^index.php.*$ ./index.php?/$0 [NC,QSA,L]
	# If the requested URL doesn't exist, let Agavi handle it
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule (.*) index.php?/$1 [QSA,L]
</IfModule>