RewriteEngine On
# Auto Switch Environment
# SetEnv APPLICATION_ENV "production"
RewriteRule ^.htaccess$ - [F]
# Remove the trailing slash at the end of
# the URI to avoid returning a 404 page error
RewriteBase /
DirectorySlash Off
# Remove trailing slash
RewriteRule ^(.*)/(?.*)?$ $1$2 [R=301,L]
# Remove 'index' from the URL if there are more than one segments
RewriteRule ^index/(.+)$ /$1 [R=301,L]
# ADDITIONAL SCRIPTS END HERE
# Redirect HTTP to HTTPS - uncomment the two lines below to require the HTTPS in the URI
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]