# Default Pages ------------------------
# The DirectoryIndex command specifies what file should be run by default. 
# Multiple options are seperated by a (space)

DirectoryIndex index.php

# Prevent Folder Snooping ------------------------
# The following commands will prevent people from seeing the files that are within a folder
# By default, most servers are setup to show a list of folder contents when the DirectoryIndex files are not found

<Files .htaccess>
  order allow,deny
  deny from all
</Files>
IndexIgnore */*
Options +FollowSymLinks
Options -Indexes

# Turn on the mod_rewrite functionality ------------------------
# This command will activate the rewrite engine, allowing you to use the rewrite rules that will detect and many common Joomla exploits

RewriteEngine On

# Specify the Base Folder of your Joomla Installation ------------------------
# In most cases, your Joomla installation will be installed directly into your /public_html folder.
# If you have installed the Joomla files under a sub-folder, then you will need to specify the location using this command.
# ie: if Joomla is installed in the folder /home/{account}/public_html/web/, then the command should read "RewriteBase /web"
# remove the "#" before the command if you are going to use it

# RewriteBase /folder-name

# SEF Rewrite Conditions ------------------------
# If you are going to use the SEF functionality built into the Joomla System (or a third party package like JoomlaSEF)
#   then you will need to uncomment (remove the "#" before each line) the commands below.
# These commands will tell your server to redirect all incoming requests that are not images to the index.php file
#   where Joomla will interpret the command and determine the correct page to return
# Many 3rd party SEF applications will come with their own version of these commands. 
#   Always be a good boy and follow directions!!

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

# Rewrite rules to block out some common exploits ------------------------
# These are the magic security commands that attempt to block the most common
#   type of exploit `attempts` made on Joomla installations!
# If you experience problems on your site, add a "#" before each of the following lines
#   to de-activate the commands from being included

RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php?error=jInject [F,L]

# Add the Missing "WWW" when the url is incomplete ------------------------
# Sometimes people will type "website.com" instead of "www.website.com", which can (sometimes) cause issues
#   with SSL Certificates, Cookies, Flash Scripts, or Javascripts that have strong security features and do not recognize
#   that both urls are the same.  The following command will correct those problems by redirecting the visitor to
#   the "www.website.com" URL when they type in the url without the prefix.
# This command can also be handy when you are directing people to a subdomain like "support.website.com"
# To activate, remove the "#" before the following command lines and replace "website.com" with your domain name

# RewriteCond %{HTTP_HOST} !^www\.website\.com$ [NC]
# RewriteRule ^(.*)$ http://www.website.com/$1 [R=301,L]
