# BEAM WebService Settings

# For 1and1
#AddType x-mapp-php6 .php

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Add Python support
AddHandler cgi-script py

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

#Script PUT put.php

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in config.php
# but the following cannot be changed at runtime.

# PHP config
php_value magic_quotes_gpc                0
php_value register_globals                0
php_value session.auto_start              0
php_value mbstring.http_input             pass
php_value mbstring.http_output            pass
php_value mbstring.encoding_translation   0
php_value upload_max_filesize             "250M"
php_value post_max_size                   "500M"

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  ExpiresActive On

  # Default 1 week
#  ExpiresDefault A604800

  # Cache images for 1 month
  ExpiresByType image/jpg "access 1 month"
  ExpiresByType image/jpeg "access 1 month"
  ExpiresByType image/gif "access 1 month"
  ExpiresByType image/png "access 1 month"
  ExpiresByType image/x-icon "access 1 month"
  ExpiresByType application/pdf "access 1 month"
	
  # Cache javascript and CSS for 1 week
  ExpiresByType application/x-javascript "access 1 week"
  ExpiresByType text/css "access 1 week"

  # HTML 1mins
#  ExpiresByType text/html A2
</IfModule>


# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  # PHP (CGI mode) HTTP Authorization with ModRewrite:
  RewriteEngine on
  RewriteCond %{HTTP:Authorization} ^(.*)
  RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]

# Allow direct access to some things so themes,javascript and caching works
  RewriteRule ^(.*\.css)$		$1 [L,NC]
  RewriteRule ^(.*\.js)$		$1 [L,NC]
  RewriteRule ^(.*\.java)$		$1 [L,NC]

# Allow direct access to old /files path for pictures only for caching
  RewriteRule ^(files/.*\.jpg)$		$1 [L,NC]
  RewriteRule ^(files/.*\.jpeg)$	$1 [L,NC]
  RewriteRule ^(files/.*\.png)$		$1 [L,NC]
  RewriteRule ^(files/.*\.gif)$		$1 [L,NC]
#  RewriteRule ^(files/.*\.mp3)$		$1 [L,NC]
  RewriteRule ^(icons/.*\.gif)$		$1 [L,NC]
  RewriteRule ^(icons/.*\.png)$		$1 [L,NC]
  RewriteRule ^(icons/.*\.jpg)$		$1 [L,NC]
  RewriteRule ^(themes/.*\.gif)$	$1 [L,NC]
  RewriteRule ^(themes/.*\.png)$	$1 [L,NC]
  RewriteRule ^(themes/.*\.jpg)$	$1 [L,NC]
  RewriteRule ^(lib/.*\.gif)$		$1 [L,NC]
  RewriteRule ^(lib/.*\.png)$		$1 [L,NC]
  RewriteRule ^(lib/.*\.php)$		$1 [L,NC]
  RewriteRule ^(lib/java/.*\.jar)$	$1 [L,NC]
#  RewriteRule ^(.*\.php)$		$1 [L,NC]

# All other URL's through index.php
#  RewriteRule ^(.*)$		index.php?q=$1 [L,QSA]
  RewriteRule ^(.*)$		index.php [L,QSA]
</IfModule>
