#
# Configuration for Kohana
#

UseCanonicalName On
Alias /kohana "/srv/www/kohana"

<Directory /srv/www/kohana>
   Options FollowSymLinks Indexes
   AllowOverride None
   Order allow,deny
   Allow from all

   <Files ~ .(inc.php|tpl)>
       Order allow,deny
       Deny from all
   </Files>

   <IfModule mod_php5.c>
       # php settings
       AcceptPathInfo on
       LimitRequestBody 0
       php_admin_flag magic_quotes_gpc on
       php_admin_flag magic_quotes_runtime Off
       php_admin_flag file_uploads on
       php_admin_flag short_open_tag Off
       php_admin_flag session.auto_start Off
       php_admin_flag session.bug_compat_warn Off
       php_admin_flag allow_url_fopen Off
       php_admin_flag safe_mode On

       # make sure users dont change the following settings
       php_admin_flag register_globals Off
       php_admin_flag allow_url_include Off

       # improved security
       php_admin_value open_basedir "/srv/www/kohana:/tmp:/usr/bin:/usr/share/kohana:/etc/kohana"
   </IfModule>

   <IfModule mod_dir.c>
       DirectoryIndex index.php index.html index.htm
   </IfModule>

   <IfModule mod_rewrite>
		# Turn on URL rewriting
		RewriteEngine On

		# Installation directory
		RewriteBase /kohana/

		# Protect application and system files from being viewed
		#RewriteRule ^(application|modules|system) - [F,L]

		# Protect application and system files from being viewed
		RewriteCond $1 ^(application|modules|system)

		# Rewrite to index.php/access_denied/URL
		RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

		# Allow these directories and files to be displayed directly:
		# - index.php (DO NOT FORGET THIS!)
		# - robots.txt
		# - favicon.ico
		# - Any file inside of the images/, js/, or css/ directories
		RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|css)

		# No rewriting
		RewriteRule ^(.*)$ - [PT,L]

		# Allow any files or directories that exist to be displayed directly
		RewriteCond %{REQUEST_FILENAME} !-f
		RewriteCond %{REQUEST_FILENAME} !-d
		# Rewrite all other URLs to index.php/URL
		RewriteRule .* index.php/$0 [PT,L]
   </IfModule>
</Directory>
