# Initialization
AddDefaultCharset utf-8
Options -Indexes
# Set a fallback resource if mod_rewrite is not enabled
# Requires Apache version >= 2.2.16
# If install in subfolder the path to index.php will need to be adjusted
<IfModule !mod_rewrite.c>
FallbackResource /index.php
</IfModule>
# InstantCMS rewriting rules
<IfModule mod_rewrite.c>
RewriteEngine on
# To redirect all users to access the site without the www. prefix
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
# HTTPS redirect if available
# RewriteCond %{HTTPS} !=on
# RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# Hide text files
RewriteRule ^.htaccess$ - [F]
RewriteRule ^credits.txt$ - [F]
RewriteRule ^readme.txt$ - [F]
RewriteRule ^license.(.*).txt$ - [F]
# Remove trailing slash from URLs
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Sitemaps
RewriteRule ^sitemap(.*).xml$ ./cache/static/sitemaps/sitemap$1.xml [L]
# Engine routing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php [L]
</IfModule>