# ------------------------------------
# RZ_CMS
# REZO ZERO
# Ambroise Maupate & Julien Blanchet
# 
# .htaccess
# ------------------------------------

# On OVH Servers you hav to manually activate PHP 5.4, just comment out the following line.
#SetEnv ZEND_OPTIMIZER 1
#SetEnv PHP_VER 5_4

# On "Not found" error, redirect on home page
ErrorDocument 404 /

IndexIgnore *

# ------------------------------------
# EXPIRES CACHING 
# ------------------------------------
<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/jpg "access plus 1 year"
	ExpiresByType image/jpeg "access plus 1 year"
	ExpiresByType image/gif "access plus 1 year"
	ExpiresByType image/png "access plus 1 year"
	ExpiresByType text/css "access plus 1 week"
	ExpiresByType application/pdf "access plus 1 month"
	ExpiresByType application/javascript "access plus 1 month"
	ExpiresByType text/x-javascript "access plus 1 week"
	ExpiresByType text/javascript "access plus 1 week"
	ExpiresByType application/x-shockwave-flash "access plus 1 month"
	ExpiresByType image/x-icon "access plus 1 year"
	ExpiresDefault "access plus 2 days"

	<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|js|css)$">
		Header unset Pragma
		Header set Cache-Control "public"
	</FilesMatch>
</IfModule>

# --------------------
# REWRITE ENGINE
# --------------------
RewriteEngine On
#RewriteBase /

# Redirect to www
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# ByPass for these folders
RewriteRule ^documents - [L,NC]
RewriteRule ^rz-core - [L,NC]
RewriteRule ^rz-conf - [L,NC]
RewriteRule ^rz-temp - [L,NC]
RewriteRule ^templates - [L,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

# ------------------------------
# Double auth for administration to add in Apache Virtual host conf
# ------------------------------
#<Location /xxxx/rz-admin >
#    AuthType Basic
#	AuthName "Double authentification required"
#    AuthUserFile /var/www/xxxx/rz-conf/.htpasswd
#    Require valid-user
#</Location>
