### SILVERSTRIPE START ###
<Files *.ss>
	Order deny,allow
	Deny from all
	Allow from 127.0.0.1
</Files>

<Files web.config>
	Order deny,allow
	Deny from all
</Files>

# This denies access to all yml files, since developers might include sensitive
# information in them. See the docs for work-arounds to serve some yaml files
<Files ~ "\.ya?ml$">
	Order allow,deny
	Deny from all
</Files>

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>
    DirectoryIndex disabled
	SetEnv HTTP_MOD_REWRITE On
	RewriteEngine On	
	RewriteBase /

	RewriteRule ^vendor(/|$) - [F,L,NC]
	RewriteRule silverstripe-cache(/|$) - [F,L,NC]
	RewriteRule composer\.(json|lock) - [F,L,NC]

	# FORCE TRAILING SLASHES #
	#RewriteCond %{THE_REQUEST} !^POST
	#RewriteCond %{REQUEST_FILENAME} !-f
	#RewriteCond %{REQUEST_URI} !(.*)/$
	#RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
	# FORCE TRAILING SLASHES END #
	

	RewriteCond %{THE_REQUEST} !^POST
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_URI} !(.*)/$
	RewriteRule ^(.*)$ https://www.aestheticbeautycentre.co.uk/$1/ [L,R=301]

        #AG: Force www. rewrite
        RewriteCond %{THE_REQUEST} !^POST
        RewriteCond %{HTTP_HOST} !^localhost
        RewriteCond %{HTTP_HOST} !^www\.
        RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

	RewriteCond %{REQUEST_URI} ^(.*)$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_URI} !\.php$
	RewriteRule .* framework/main.php?url=%1 [QSA]

	RewriteCond %{REQUEST_URI} ^(.*)/framework/main.php$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule . %1/install.php? [R,L]

</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/gif "access plus 7 day"
  ExpiresByType image/png "access plus 7 day"
  ExpiresByType image/jpg "access plus 7 day"
  ExpiresByType image/jpeg "access plus 7 day"
  ExpiresByType image/ico "access plus 7 day"
  ExpiresByType text/css "access plus 7 day"
  ExpiresByType text/javascript "access plus 7 day"
  ExpiresByType application/x-javascript "access plus 7 day"
</IfModule>
### SILVERSTRIPE END ###
