# InstantCMS rewriting rules

# Initialization
AddDefaultCharset utf-8
Options -Indexes
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]
