<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=G1smd</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=G1smd"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/G1smd"/>
	<updated>2026-06-26T03:28:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58270</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58270"/>
		<updated>2011-05-17T21:02:22Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.5 - Change rule order to prevent URL request with query string exploit accidentally being allowed when a previous &amp;quot;RewriteRule - [L]&amp;quot; exception stopped processing of request &amp;quot;too early&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 16th, 2011)&lt;br /&gt;
## - Placeholders for custom code. Correction of ruleset ordering.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection - query strings, referrer and config&lt;br /&gt;
# Advanced server protection, version 3.2 - May 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection - query strings, referrer and config&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection - paths and files&lt;br /&gt;
# Advanced server protection, version 3.2 - May 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection - paths and files&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58269</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58269"/>
		<updated>2011-05-17T20:54:21Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.4 - Change rule order to prevent URL request with exploit accidentally being allowed when a previous &amp;quot;RewriteRule - [L]&amp;quot; exception has stopped the processing of that request &amp;quot;too early&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 14th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 14th, 2011)&lt;br /&gt;
## - Placeholders for custom code. Correction of ruleset ordering.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58268</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58268"/>
		<updated>2011-05-17T20:45:37Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.3 - Changing rule order such that mod_rewrite and other setup code is placed closer to the rules that it applies to and is therefore easier to follow.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 13th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 13th, 2011)&lt;br /&gt;
## - Placeholders for custom code. Correction of ruleset ordering.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58267</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58267"/>
		<updated>2011-05-17T20:41:40Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.2 - Redirecting a malicious request only to later block it is inefficient. Move external redirect mod_rewrite code to be after the mod_rewrite code which blocks malicious requests.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 12th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 12th, 2011)&lt;br /&gt;
## - Placeholders for custom code. Correction of ruleset ordering.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58266</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58266"/>
		<updated>2011-05-17T20:33:22Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.1 - Change rule order to prevent an unwanted multiple step redirection chain when a non-www URL on the old domain and/or a URL which is going to be forced to https is requested.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 11th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 11th, 2011)&lt;br /&gt;
## - Placeholders for custom code. Correction of ruleset ordering.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58265</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58265"/>
		<updated>2011-05-17T20:29:53Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed 2.5.0 - Added placeholders for custom mod_rewrite rules using RewriteRule [F] (blocking), RewriteRule [R=301,L] (redirecting) and RewriteRule [L] (rewriting). [Compare with version 2.4.9.]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.5 (proposed) - May 10th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.5 (proposed) (May 10th, 2011)&lt;br /&gt;
## - Placeholders for custom code.&lt;br /&gt;
## Version 2.4 (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
	# Enable expiration control&lt;br /&gt;
	ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
	# Default expiration: 1 hour after request&lt;br /&gt;
	ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# CSS and JS expiration: 1 week after request&lt;br /&gt;
	ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
	ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Image files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Audio files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	# Movie files expiration: 1 month after request&lt;br /&gt;
	ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
	ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom redirects&lt;br /&gt;
#&lt;br /&gt;
# If you need to redirect some pages, place that code here. Ensure those&lt;br /&gt;
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom redirects&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Add optional bad user agent or IP blocking code&lt;br /&gt;
#&lt;br /&gt;
# If you need to block certain user agents or IP addresses and&lt;br /&gt;
# other signatures, place that code here. Ensure the rules use&lt;br /&gt;
# the correct RewriteRule syntax and the [F] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Add optional bad user agent or IP blocking code&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Custom internal rewrites&lt;br /&gt;
#&lt;br /&gt;
# If you need to internally rewrite some specific URL requests,&lt;br /&gt;
# place that code here. Ensure those internal rewrites use the&lt;br /&gt;
# correct RewriteRule syntax without domain name and with [L] flag.&lt;br /&gt;
#&lt;br /&gt;
########## End - Custom internal rewrites&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58221</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58221"/>
		<updated>2011-05-14T14:03:54Z</updated>

		<summary type="html">&lt;p&gt;G1smd: URL updates.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 18th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nicholas!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/ and http://snipt.net/g1smd/joomla-patch/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4528051/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58141</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=58141"/>
		<updated>2011-05-08T20:21:08Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.9 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 18th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 18th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
## If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} \.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !/index[23]?\.php$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^([^/]+/)*([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: &lt;br /&gt;
http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Multiple_Domains_and_Web_Sites_in_a_single_Joomla!_installation&amp;diff=58122</id>
		<title>Multiple Domains and Web Sites in a single Joomla! installation</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Multiple_Domains_and_Web_Sites_in_a_single_Joomla!_installation&amp;diff=58122"/>
		<updated>2011-05-07T12:14:40Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Code for redirect generates 302 not 301. In any case, the code cannot possibly work at all when pasted where recommnded in the article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although it&#039;s a best-practice to give every Website its own domain, Joomla! installation and database there can be special conditions in which a multi-site solution under a single Joomla! install is warranted.&lt;br /&gt;
&lt;br /&gt;
==An Example Application==&lt;br /&gt;
A small business, &#039;Johnson Candies&#039;, has two separate but related brands: &#039;&#039;Red Candy&#039;&#039; and &#039;&#039;Yellow Candy&#039;&#039;. They require a single Joomla!-based Website where both candy types are visible, each with its own home page on the Joomla! site which corresponds to the domains &#039;&#039;www.redjohnsoncandy.com&#039;&#039; and &#039;&#039;www.yellowjohnsoncandy.com&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Additionally, each brand and site &#039;&#039;&#039;requires its own design&#039;&#039;&#039;: a yellow template for one; a red template, for the other.&lt;br /&gt;
==Benefits==&lt;br /&gt;
By including both brands in a single Joomla! web installation, Johnson Candies is able to save editing time (only one login), share articles and data across both brands (or sites) and use a single feature, such as a Contact Us form, for both brands.&lt;br /&gt;
==Implementation Procedure==&lt;br /&gt;
===Prepare Your Domains===&lt;br /&gt;
Use a single domain for your hosting account, as normal. Create the required add-on domains in the control panel of your hosting account. For the purpose of this tutorial, we will use &#039;&#039;www.redjohnsoncandy.com&#039;&#039; in addition to the base &#039;&#039;www.yellowjohnsoncandy.com&#039;&#039; domain name.&lt;br /&gt;
===Install and Setup Joomla!===&lt;br /&gt;
Install and setup Joomla! normally. Then develop articles, menus and modules for each site.&lt;br /&gt;
===Create Templates===&lt;br /&gt;
Next develop and install the necessary templates - one for each site that you wish to have. In the above example, you would create a template for &#039;&#039;red candy&#039;&#039; named &#039;&#039;Red Template&#039;&#039; and a template for &#039;&#039;yellow candy&#039;&#039; named &#039;&#039;Yellow Template&#039;&#039;. Once the templates are installed, assign them to the relevant menu items, using the Joomla! template manager in the Joomla! Administrator area.&lt;br /&gt;
===Add a Redirect===&lt;br /&gt;
====Option #1: Create an .htaccess (Apache) redirect====&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; &#039;&#039;Enable SEF URLs in Joomla! First&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
One option is to use .htaccess (Apache) to redirect inquiries to a given domain to a specific Joomla! page.&lt;br /&gt;
&lt;br /&gt;
Our goal is to redirect any inquries to the Red Candy domain name to a given page on the Joomla! site. In this example, we redirect any inquiries to www.redjohnsoncandy.com to a category-blog page. You would have previously assigned the &#039;red candy&#039; template to this menu item, to create the illusion of a separate site.&lt;br /&gt;
&amp;lt;source lang=&#039;apache&#039;&amp;gt;&lt;br /&gt;
#The following rule works, but it changes which domain name displays.&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?redjohnsoncandy\.com$&lt;br /&gt;
RewriteRule (.*) http://www.yellowjohnsoncandy.com/index.php?option=com_content&amp;amp;view=category&amp;amp;layout=blog&amp;amp;id=3&amp;amp;Itemid=12 [R=301,L]&lt;br /&gt;
&amp;lt;/source&amp;gt; &lt;br /&gt;
Well, that works - but you can see the drawback immediately. Although the user is successfully viewing the Red Candy site, they will still see the Yellow Candy domain name. Unfortunately, if you are using both .htaccess and domain-parking (technically a redirect) - this is necessary in order to avoid creating a LOOP.&lt;br /&gt;
&lt;br /&gt;
====Option #2: Create a PHP Header Redirect====&lt;br /&gt;
This solution has the benefit of keeping the illusion of separate domains/web sites apparent to the visitor. Instead of using .htaccess (Apache) for our redirect, we use one of the templates on the site.&lt;br /&gt;
&lt;br /&gt;
In this example, the base domain is www.redjohnsoncandy.com. You have created a template for that area named &#039;&#039;Red Template&#039;&#039;. The trick is to open &#039;Red Template&#039;s&#039; index.php file and add the following to the head area.&lt;br /&gt;
&amp;lt;source lang=&#039;php&#039;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$domain = $_SERVER[&amp;quot;HTTP_HOST&amp;quot;];&lt;br /&gt;
if (($domain == &amp;quot;redjohnsoncandy.com&amp;quot;) ||&lt;br /&gt;
   ($domain == &amp;quot;www.redjohnsoncandy.com&amp;quot;)) { &lt;br /&gt;
   header(&amp;quot;Status: 301 Moved Permanently&amp;quot;);&lt;br /&gt;
   header(&amp;quot;Location: http://www.redjohnsoncandy.com/index.php?option=com_content&amp;amp;view=category&amp;amp;layout=blog&amp;amp;id=3&amp;amp;Itemid=12&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Here&#039;s the benefit: The visitor will now be redirected to the appropriate &#039;&#039;Red Site&#039;&#039; page, that has the &#039;&#039;Red Template&#039;&#039; assigned to it &#039;&#039;&#039;only&#039;&#039;&#039; in the case where they have arrived at the &#039;red site&#039; domain name. Otherwise, the conditional PHP rule is ignored, and the Yellow Site loads.&lt;br /&gt;
&lt;br /&gt;
====Option #3: Create a PHP Header Redirect, for multiple domains with specific domain redirects for custom templates====&lt;br /&gt;
&lt;br /&gt;
Solution for single webspace, with different domains, one Joomla install and depending on the user landing domain, redirects to a different default page. Paste following PHP code after the &amp;lt;head&amp;gt; of your Joomla template. To assign another domain, just copy/past the &amp;quot;if&amp;quot; function and edit it with the values of the other domain in the same fashion. Further to setup the template views, you will have to assign different module item/link alias and setup template views within the Joomla! template manager. The alias setting is needed when you use SEF settings.&lt;br /&gt;
&amp;lt;source lang=&#039;php&#039;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$domain = $_SERVER[&amp;quot;SERVER_NAME&amp;quot;];&lt;br /&gt;
$requri = $_SERVER[&#039;REQUEST_URI&#039;];&lt;br /&gt;
if (($domain == &amp;quot;www.example.de&amp;quot; &amp;amp;&amp;amp; $requri == &amp;quot;/&amp;quot; || &lt;br /&gt;
   $domain == &amp;quot;example.de&amp;quot;))  { &lt;br /&gt;
   header(&amp;quot;Status: 301 Moved Permanently&amp;quot;);&lt;br /&gt;
   header(&amp;quot;Location: http://www.example.de/index.php?option=com_content&amp;amp;view=article&amp;amp;id=6&amp;quot;); &lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
The last two code examples will result in &amp;quot;headers already sent&amp;quot; error message. It is too late to send HTTP headers once the page HTML is being sent.&lt;br /&gt;
[[Category:Tips and tricks]]&lt;br /&gt;
[[Category:Tips and tricks 1.5]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=IIS&amp;diff=50975</id>
		<title>IIS</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=IIS&amp;diff=50975"/>
		<updated>2011-04-24T15:44:18Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Reworded to show the correct direction of travel for a rewrite. It&amp;#039;s a URL to filepath translation!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Whilst IIS accounts for relatively few users, compared to Apache, there are enough to warrant providing information which is unique.&lt;br /&gt;
&lt;br /&gt;
PHP can run on IIS (Microsoft web server, Internet Information Services). So, a Joomla! web site also can run on IIS.&lt;br /&gt;
&lt;br /&gt;
The PHP.net website should be referenced, regarding the installation of PHP on Windows and the configuraiton of IIS to process PHP webpages and scripts.&lt;br /&gt;
&lt;br /&gt;
The two most common problems encountered by Joomla! admins whose sites are on IIS webservers are:&lt;br /&gt;
* Setting the website&#039;s directory/filesystem permissions correctly&lt;br /&gt;
* Enabling SEF URLs&lt;br /&gt;
&lt;br /&gt;
==Setting the filesystem permissions==&lt;br /&gt;
&lt;br /&gt;
===Conceptual Overview===&lt;br /&gt;
Windows filesystem permissions are more complex than the 3-level, 3-value Unix-style &amp;lt;code&amp;gt;rw-r--r--&amp;lt;/code&amp;gt; conventions. &lt;br /&gt;
&lt;br /&gt;
Windows servers have a user called &amp;lt;code&amp;gt;IUSR&amp;lt;/code&amp;gt;, which corresponds to the &amp;lt;code&amp;gt;apache&amp;lt;/code&amp;gt; user on many Linux systems. PHP scripts run under the IUSR account.&lt;br /&gt;
&lt;br /&gt;
====Levels====&lt;br /&gt;
A directory or file does have an &amp;lt;code&amp;gt;owner&amp;lt;/code&amp;gt;, and Windows does have &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;s, but there is no &amp;lt;code&amp;gt;&amp;quot;everyone else&amp;quot;&amp;lt;/code&amp;gt; under Windows. &lt;br /&gt;
&lt;br /&gt;
There is a group called &amp;lt;code&amp;gt;Users&amp;lt;/code&amp;gt;. This corresponds to all accounts used by human beings to deliberately interact with the server. But accounts for services, system operations, and software user permisions do not belong to that group, and in fact &#039;&#039;&#039;no&#039;&#039;&#039; accounts at all (human or otherwise) have &#039;&#039;&#039;any&#039;&#039;&#039; privileges which aren&#039;t explicitly granted either directly to the user or by membership in some group.&lt;br /&gt;
&lt;br /&gt;
====Values====&lt;br /&gt;
Beyond &amp;lt;code&amp;gt;Read&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Write&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Execute&amp;lt;/code&amp;gt;, Windows permissions include additional values. The important ones to know about for a Joomla website are &amp;lt;code&amp;gt;Read&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Write&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===HowTo configure the permissions===&lt;br /&gt;
When logged in to the Windows server, run Windows Explorer, and navigate to inetpub.&lt;br /&gt;
&lt;br /&gt;
Right-click the directory which holds your Joomla site.&amp;lt;br /&amp;gt;&lt;br /&gt;
Get Properties, tab to Security.&amp;lt;br /&amp;gt;&lt;br /&gt;
Click ADD.&amp;lt;br /&amp;gt;&lt;br /&gt;
Make sure that the LOCATION field is set to the local computer, not a domain controller.&amp;lt;br /&amp;gt;&lt;br /&gt;
Type iis_iusrs into the field for identifying the user/group you are granting access to.&amp;lt;br /&amp;gt;&lt;br /&gt;
Confirm.&amp;lt;br /&amp;gt;&lt;br /&gt;
Highlight the iis_iusrs entry in the access control list.&amp;lt;br /&amp;gt;&lt;br /&gt;
Check the boxes for Read &amp;amp; Execute, List Folder Contents, Read, and Write&amp;lt;br /&amp;gt;&lt;br /&gt;
Confirm, put the security window away now.&amp;lt;br /&amp;gt;&lt;br /&gt;
Open Start -. Administrator -&amp;gt; Computer Management.&amp;lt;br /&amp;gt;&lt;br /&gt;
Navigate to Local Users and Groups -&amp;gt; Groups.&amp;lt;br /&amp;gt;&lt;br /&gt;
Find or create the group iis_iusrs&amp;lt;br /&amp;gt;&lt;br /&gt;
Add a member to the group:&amp;lt;br /&amp;gt;&lt;br /&gt;
again, make sure that the LOCATION field is set to the local computer, not a domain controller.&amp;lt;br /&amp;gt;&lt;br /&gt;
Type IUSR into the field for identifying the user/group you are granting access to.&amp;lt;br /&amp;gt;&lt;br /&gt;
Confirm.&amp;lt;br /&amp;gt;&lt;br /&gt;
Save.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the Joomla installer again, and enjoy your PHP user&#039;s write privileges in your website folder.&lt;br /&gt;
&lt;br /&gt;
==SEF URLs==&lt;br /&gt;
The functioning of SEF URLs depends on &amp;quot;URL rewriting&amp;quot; - matching patterns in incoming HTTP requests, and passing the request to the webserver in a different format. Joomla can only understand the parameters present in the &amp;quot;ugly&amp;quot; request, so the human-readable path in the incoming HTTP request needs to be re-written for Joomla.&lt;br /&gt;
&lt;br /&gt;
===Apache&#039;s mod_rewrite===&lt;br /&gt;
&amp;lt;code&amp;gt;mod_rewrite&amp;lt;/code&amp;gt; is the familiar way by which many webmasters translate nice human-readable, spider-friendly URL requests like &amp;lt;code&amp;gt;/about_us/contact_information&amp;lt;/code&amp;gt; into the &amp;quot;ugly&amp;quot; internal server path like &amp;lt;code&amp;gt;/index.php?option=com_content&amp;amp;view=article&amp;amp;id=999&amp;amp;Itemid=23&amp;lt;/code&amp;gt; that makes Joomla serve up some content. A text file called .htaccess contains the rewrite rules, which are written according to a specific syntax.&lt;br /&gt;
&lt;br /&gt;
===IIS===&lt;br /&gt;
Before Windows Server 2008 and IIS7, only third-party add-ons could add URL rewriting functionality to an IIS webserver. For servers today still running IIS6 or earlier, these are still available. CodePlex is a website and code-sharing developer forge associated with Microsoft, and it hosts at least two good-quality URL rewrite solutions for IIS6. At least one of these modules will parse and execute the same rewrite rules which work in Apache .htaccess files.&lt;br /&gt;
&lt;br /&gt;
Windows Server 2008 comes with IIS7, which is the first webserver for which Microsoft provides a native module which provides URL rewriting functionality.&lt;br /&gt;
&lt;br /&gt;
The module is called &amp;quot;IIS URL Rewrite Module&amp;quot; and is free to download and install on your IIS7 webserver.&lt;br /&gt;
&lt;br /&gt;
The IIS7 module configures and stores its rules in a very different way than the format Apache provides via .htaccess. The rules are stored as XML data in the web.config file in a website&#039;s root. The IIS Management Console provides a GUI and wizard for creating and testing rules. The wizard is capable of reading a text file with .htaccess-type rules and converting them to the native format.&lt;br /&gt;
&lt;br /&gt;
Specific &#039;&#039;&#039;instruction information&#039;&#039;&#039; is available about &#039;&#039;&#039;[[SEO and IIS]]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:IIS]][[Category:FAQ]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Adding_www_to_a_url&amp;diff=50974</id>
		<title>Adding www to a url</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Adding_www_to_a_url&amp;diff=50974"/>
		<updated>2011-04-24T14:46:34Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Updated and more comprehensive code.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How do I get www as a prefix in all my joomla sites? ==&lt;br /&gt;
&lt;br /&gt;
Add the following to your .htaccess file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete solution fixing several other canonicalisation issues at the same time:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;Apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
#&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
#&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
#&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Security_Checklist/Hosting_and_Server_Setup&amp;diff=50973</id>
		<title>Security Checklist/Hosting and Server Setup</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Security_Checklist/Hosting_and_Server_Setup&amp;diff=50973"/>
		<updated>2011-04-24T14:32:19Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Typo.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
== Choose a Qualified Hosting Provider ==&lt;br /&gt;
&lt;br /&gt;
===The most important decision===&lt;br /&gt;
: Probably no decision is more critical to site security than the choice of hosts and servers. However, due to the wide variety of hosting options and configurations, it&#039;s not possible to provide a complete list for all situations. Check this unbiased [http://resources.joomla.org/directory/support-services/hosting.html list of recommended hosts]who fully meet the security requirements of a typical Joomla site. ([[Security_and_Performance_FAQs#How_do_I_choose_a_quality_hosting_provider.3F|FAQ]])&lt;br /&gt;
&lt;br /&gt;
===Shared server risks===&lt;br /&gt;
: If you are on a tight budget and your site does not process highly confidential data, you can probably get by with a shared server, but you must understand the unavoidable risks. Most of the tips listed below are appropriate for securing sites on shared server environments.&lt;br /&gt;
&lt;br /&gt;
===Avoid sloppy server configurations===&lt;br /&gt;
: For a real eye-opener, [http://www.nexen.net/articles/dossier/php_configuration_statitstics.php read this report] on thousands of sites that allowed Google to index the results of phpinfo(). Don&#039;t make this mistake on your site! The report includes alarming statistics on the percentage of sites that use depreciated settings such as register_globals ON or that don&#039;t have open_basedir set at all: By the way, if &#039;&#039;phpini&#039;&#039; and &#039;&#039;register_globals&#039;&#039; are unfamiliar terms you are probably not ready to securely manage your own site.&lt;br /&gt;
&lt;br /&gt;
==Configuring Apache==&lt;br /&gt;
&lt;br /&gt;
===Use Apache .htaccess===&lt;br /&gt;
&#039;&#039;See also [[htaccess examples (security)|.htaccess examples]]&#039;&#039;&lt;br /&gt;
: Block typical exploit attempts with local Apache &#039;&#039;.htaccess&#039;&#039; files. This option is not enabled on all servers. Check with your host if you run into problems. Using &#039;&#039;.htaccess&#039;&#039;, you can password protect sensitive directories, such as administrator, restrict access to sensitive directories by IP Address, and depending on your server&#039;s configuration, you may be able to increase security by switching from PHP4 to PHP5.&lt;br /&gt;
&lt;br /&gt;
: Joomla ships with a [[preconfigured .htaccess]] file, but *you* need to choose to use it. The file is called htaccess.txt. To use it, rename it to .htaccess and place it in the root of your site using FTP. One important point to note is that as the distributed file is called htaccess.txt and the live file on your site is called .htaccess, the file your site actually uses is NOT updated when you update your site to use to a new version of Joomla. You must manually make the changes to use the new file version. There are significant changes in the file distributed with 1.5.23 onwards and 1.6.2 onwards.&lt;br /&gt;
&lt;br /&gt;
: Consider following the &amp;quot;Least Privilege&amp;quot; principle for running PHP using tools such as PHPsuExec, php_suexec or suPHP. (Note: These are advanced methods that require agreement and coordination with your hosting provider. Such options are enabled or disabled on a server-wide basis and are not individually adjustable on shared servers.) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Apache mod_security===&lt;br /&gt;
: Configure Apache mod_security and mod_rewrite filters to block PHP attacks. See [http://www.google.com/search?q=apache%20mod_security Google search for mod_security] and [http://www.google.com/search?q=apache%20mod_rewrite Google search for mod_rewrite]. (Note: These are advanced methods that usually require agreement and coordination with your hosting provider. Such options are enabled or disabled on a server-wide basis and are not individually adjustable on shared servers.)&lt;br /&gt;
&lt;br /&gt;
==Configuring MySQL== &lt;br /&gt;
&lt;br /&gt;
===Secure the database===&lt;br /&gt;
: Be sure MySQL accounts are set with limited access. The initial install of MySQL is insecure and careful configuration is required. (See the [http://dev.mysql.com/doc/ MySQL Manuals]) Note: This item applies only to those administering their own servers, such as dedicated servers. Users of shared servers are dependent on their hosting provider to set proper database security.)&lt;br /&gt;
&lt;br /&gt;
== Configuring PHP==&lt;br /&gt;
&lt;br /&gt;
===Understand how PHP works===&lt;br /&gt;
: Understand how to work with the php.ini file, and how PHP configurations are controlled. Study the [http://us3.php.net/manual/en/ini.php#ini.list Official List of php.ini Directives] at http://www.php.net, and the well-documented default php.ini file included with every PHP install. Here is the [http://svn.php.net/viewvc/php/php-src/trunk/php.ini-production?view=co latest default php.ini file] on the official PHP site.&lt;br /&gt;
&lt;br /&gt;
===Use PHP5===&lt;br /&gt;
: Currently, both PHP4 and PHP5 are maintained, and both are often available on servers. Before PHP4 becomes obsolete, upgrade your custom scripts to PHP5. Don&#039;t worry about core Joomla code; all current versions are PHP5 compatible. (See [http://www.php.net/ PHP News])&lt;br /&gt;
&lt;br /&gt;
===Use local php.ini files===&lt;br /&gt;
: On shared servers you can&#039;t edit the main php.ini file, but you may be able to add custom, local php.ini files. If so, you&#039;ll need to copy the php.ini files to every sub-directory that requires custom settings. Luckily a [http://tips-scripts.com/free set of scripts at B &amp;amp; T Scripts and Tips] can do the hard work for you.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;There are a few important things to keep in mind.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Local &#039;&#039;php.ini&#039;&#039; files &#039;&#039;&#039;&#039;&#039;only&#039;&#039;&#039;&#039;&#039; have an effect if your server is configured to use them. This includes a &#039;&#039;php.ini&#039;&#039; file in your &#039;&#039;http_root&#039;&#039; directory. You can test whether or not these file affect your site by setting an obvious directive in the local &#039;&#039;php.ini&#039;&#039; file to see if it affects your site.&lt;br /&gt;
# Local &#039;&#039;php.ini&#039;&#039; files only effect &#039;&#039;.php&#039;&#039; files that are located within the same directory (or included() or required() from those files). This means that there are normally only two Joomla! directories in which you would want to place a &#039;&#039;php.ini&#039;&#039; file. They are your &#039;&#039;http_root&#039;&#039;(your actual directory name may vary), which is where Joomla&#039;s Front-end &#039;&#039;index.php&#039;&#039; file is located, and the Joomla! &#039;&#039;administrator&#039;&#039; directory, which is where the Back-end administrator &#039;&#039;index.php&#039;&#039; file is located. Other directories that don&#039;t have files called via the Web do not need local &#039;&#039;php.ini&#039;&#039; files.&lt;br /&gt;
# If you have a &#039;&#039;php.ini&#039;&#039; file in every directory, some script probably did this for you. If you didn&#039;t intend it to happen, you probably should root them out, but given #2 above, you probably only have to panic about the &#039;&#039;php.ini&#039;&#039; files in &#039;&#039;http_root&#039;&#039; and the &#039;&#039;administrator&#039;&#039; directories.&lt;br /&gt;
&lt;br /&gt;
===Use PHP disable_functions===&lt;br /&gt;
: Use &#039;&#039;disable_functions&#039;&#039; to disable dangerous PHP functions that are not needed by your site. Here is a typical setup for a Joomla! site:&lt;br /&gt;
&lt;br /&gt;
      disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open&lt;br /&gt;
&lt;br /&gt;
===Use PHP open_basedir===&lt;br /&gt;
: &#039;&#039;open_basedir&#039;&#039; should be enabled and correctly configured. This directive limits the files that can be opened by PHP to the specified directory-tree. This directive is NOT affected by whether Safe Mode is ON or OFF. &lt;br /&gt;
&lt;br /&gt;
: The restriction specified with open_basedir is a prefix, not a directory name. This means that &#039;&#039;open_basedir = /dir/incl&#039;&#039; allows access to &#039;&#039;/dir/include&#039;&#039; and &#039;&#039;/dir/incls&#039;&#039; if they exist. To restrict access to only the specified directory, end with a slash. For more information, see [http://us3.php.net/manual/en/features.safe-mode.php#ini.safe-mode PHP Security and Safe Mode Configuration Directives].&lt;br /&gt;
&lt;br /&gt;
     open_basedir = /home/users/you/public_html&lt;br /&gt;
&lt;br /&gt;
: In some system configurations, at least with PHP 4.4.8, the use of the trailing slash to restrict the access to only the specified directory may cause Joomla to warn &#039;&#039;JFolder::create: Infinite loop detected&#039;&#039; when saving the Back-End Global Configuration. This warning is triggered because PHP &#039;&#039;file_exists()&#039;&#039; function fails, for example, when asked if &#039;&#039;/home/user/public_html/joomla_demo&#039;&#039; exists and &#039;&#039;open_basedir&#039;&#039; is set to &#039;&#039;/home/user/public_html/joomla_demo/&#039;&#039; (see the trailing slash).&lt;br /&gt;
&lt;br /&gt;
: Additionally, if &#039;&#039;open_basedir&#039;&#039; is set it may be necessary to set PHP &#039;&#039;upload_tmp_dir&#039;&#039; configuration directive to a path that falls within the scope of &#039;&#039;open_basedir&#039;&#039; or, alternatively, add the &#039;&#039;upload_tmp_dir&#039;&#039; path to &#039;&#039;open_basedir&#039;&#039; using the appropriate path separator for the host system.&lt;br /&gt;
&lt;br /&gt;
     open_basedir = /home/users/you/public_html:/tmp&lt;br /&gt;
&lt;br /&gt;
: PHP will use the system&#039;s temporary directory when &#039;&#039;upload_tmp_dir&#039;&#039; is not set or when it is set but the directory does not exist, therefore it may be necessary to add it to &#039;&#039;open_basedir&#039;&#039; as above to avoid uploading errors within Joomla.&lt;br /&gt;
&lt;br /&gt;
===Adjust magic_quotes_gpc===&lt;br /&gt;
: Adjust the &#039;&#039;magic_quotes_gpc&#039;&#039; directive as needed for your site. The recommended setting for Joomla! 1.0.x is ON to protect against poorly-written third-party extensions. The safest method is to turn &#039;&#039;magic_quotes_gpc&#039;&#039; off and avoid all poorly-written extensions, period. &lt;br /&gt;
&lt;br /&gt;
: Joomla! 1.5 ignores this setting and works fine either way. &lt;br /&gt;
For more information, see either [http://docs.joomla.org/Magic_quotes_and_security Magic quotes and security] or &lt;br /&gt;
[http://us3.php.net/magic_quotes PHP Manual, Chapter 31. Magic Quotes].&lt;br /&gt;
&lt;br /&gt;
      magic_quotes_gpc = 1&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP safe_mode===&lt;br /&gt;
: Avoid the use of PHP safe_mode. This is a valid but incomplete solution to a deeper problem and provides a false sense of security. See the official PHP site for an explanation of this issue.&lt;br /&gt;
&lt;br /&gt;
      safe_mode = 0&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP register_globals===&lt;br /&gt;
: Automatically registering global variables was probably one of the dumbest decisions the developers of PHP made. This directive determines whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables where they become immediately available to all PHP scripts, and where they can easily overwrite your own variable if you&#039;re not careful. Luckily, the PHP developers long since realized the mistake and have depreciated this &#039;feature&#039;. &lt;br /&gt;
&lt;br /&gt;
: If your site is on a shared server with a hosting provider that insists &#039;&#039;register_globals&#039;&#039; must be on, you should be very worried. Although you can often turn register_globals off for your own site with a local php.ini file, this adds little security as other sites on the same server remain vulnerable to attacks which can then launch attacks against your site from within the server. For more information, see [http://www.zend.com/manual/security.globals.php ZEND Chapter 29. Using Register Globals].&lt;br /&gt;
&lt;br /&gt;
      register_globals = 0&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP allow_url_fopen===&lt;br /&gt;
&lt;br /&gt;
: Don&#039;t use PHP &#039;&#039;allow_url_fopen&#039;&#039;. This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers. Note: This can only be set in php.ini due to security reasons.&lt;br /&gt;
&lt;br /&gt;
      allow_url_fopen = 0&lt;br /&gt;
&lt;br /&gt;
==Setup a backup and recovery process==&lt;br /&gt;
===The most important rule:&#039;===&lt;br /&gt;
: Thou shalt at all time be able to return your site to a previous working state through regular use of a strong, off-site backup and recovery process. Be sure your backup and recovery process is in place and tested BEFORE you go live. This is the single best way (and often the only way) to recover from such inevitable catastrophes as:&lt;br /&gt;
&lt;br /&gt;
# A compromised/cracked site.&lt;br /&gt;
# Broken site due to a faulty upgrade.&lt;br /&gt;
# Hardware failure, such as dead hard drives, power failures, server theft, etc.&lt;br /&gt;
# Authoritarian government intervention. (More common than some think.)&lt;br /&gt;
# Needing to quickly relocate to a new server or hosting provider.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Choose A Checklist==&lt;br /&gt;
# [[Security Checklist 1 - Getting Started|Getting Started]] &lt;br /&gt;
# [[Security Checklist 2 - Hosting and Server Setup|Hosting and Server Setup]]&lt;br /&gt;
# [[Security Checklist 3 - Testing and Development|Testing and Development]]&lt;br /&gt;
# [[Security Checklist 4 - Joomla Setup|Joomla Setup]]&lt;br /&gt;
# [[Security Checklist 5 - Site Administration|Site Administration]]&lt;br /&gt;
# [[Security Checklist 6 - Site Recovery|Site Recovery]]&lt;br /&gt;
&lt;br /&gt;
== Edited by==&lt;br /&gt;
[http://forum.joomla.org/memberlist.php?mode=viewprofile&amp;amp;u=39784 rliskey]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- KEEP THIS AT THE END OF THE PAGE --&amp;gt;&lt;br /&gt;
[[Category:Security Checklist]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Security_Checklist/Hosting_and_Server_Setup&amp;diff=50972</id>
		<title>Security Checklist/Hosting and Server Setup</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Security_Checklist/Hosting_and_Server_Setup&amp;diff=50972"/>
		<updated>2011-04-24T14:31:36Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Improved wording.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
== Choose a Qualified Hosting Provider ==&lt;br /&gt;
&lt;br /&gt;
===The most important decision===&lt;br /&gt;
: Probably no decision is more critical to site security than the choice of hosts and servers. However, due to the wide variety of hosting options and configurations, it&#039;s not possible to provide a complete list for all situations. Check this unbiased [http://resources.joomla.org/directory/support-services/hosting.html list of recommended hosts]who fully meet the security requirements of a typical Joomla site. ([[Security_and_Performance_FAQs#How_do_I_choose_a_quality_hosting_provider.3F|FAQ]])&lt;br /&gt;
&lt;br /&gt;
===Shared server risks===&lt;br /&gt;
: If you are on a tight budget and your site does not process highly confidential data, you can probably get by with a shared server, but you must understand the unavoidable risks. Most of the tips listed below are appropriate for securing sites on shared server environments.&lt;br /&gt;
&lt;br /&gt;
===Avoid sloppy server configurations===&lt;br /&gt;
: For a real eye-opener, [http://www.nexen.net/articles/dossier/php_configuration_statitstics.php read this report] on thousands of sites that allowed Google to index the results of phpinfo(). Don&#039;t make this mistake on your site! The report includes alarming statistics on the percentage of sites that use depreciated settings such as register_globals ON or that don&#039;t have open_basedir set at all: By the way, if &#039;&#039;phpini&#039;&#039; and &#039;&#039;register_globals&#039;&#039; are unfamiliar terms you are probably not ready to securely manage your own site.&lt;br /&gt;
&lt;br /&gt;
==Configuring Apache==&lt;br /&gt;
&lt;br /&gt;
===Use Apache .htaccess===&lt;br /&gt;
&#039;&#039;See also [[htaccess examples (security)|.htaccess examples]]&#039;&#039;&lt;br /&gt;
: Block typical exploit attempts with local Apache &#039;&#039;.htaccess&#039;&#039; files. This option is not enabled on all servers. Check with your host if you run into problems. Using &#039;&#039;.htaccess&#039;&#039;, you can password protect sensitive directories, such as administrator, restrict access to sensitive directories by IP Address, and depending on your server&#039;s configuration, you may be able to increase security by switching from PHP4 to PHP5.&lt;br /&gt;
&lt;br /&gt;
: Joomla ships with a [[preconfigured .htaccess]] file, but *you* need to choose to use it. The file is called htaccess.txt. To use it, rename it to .htaccess and place it in the root of your site using FTP. One important point to note is that as the distributed file is called htaccess.txt and the live file on your site is called .htaccess, the file your site actually uses is NOT updated when you update to a new version on Joomla. You must manually make the changes to use the new file version. There are significant changes in the file distributed with 1.5.23 onwards and 1.6.2 onwards.&lt;br /&gt;
&lt;br /&gt;
: Consider following the &amp;quot;Least Privilege&amp;quot; principle for running PHP using tools such as PHPsuExec, php_suexec or suPHP. (Note: These are advanced methods that require agreement and coordination with your hosting provider. Such options are enabled or disabled on a server-wide basis and are not individually adjustable on shared servers.) &amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Use Apache mod_security===&lt;br /&gt;
: Configure Apache mod_security and mod_rewrite filters to block PHP attacks. See [http://www.google.com/search?q=apache%20mod_security Google search for mod_security] and [http://www.google.com/search?q=apache%20mod_rewrite Google search for mod_rewrite]. (Note: These are advanced methods that usually require agreement and coordination with your hosting provider. Such options are enabled or disabled on a server-wide basis and are not individually adjustable on shared servers.)&lt;br /&gt;
&lt;br /&gt;
==Configuring MySQL== &lt;br /&gt;
&lt;br /&gt;
===Secure the database===&lt;br /&gt;
: Be sure MySQL accounts are set with limited access. The initial install of MySQL is insecure and careful configuration is required. (See the [http://dev.mysql.com/doc/ MySQL Manuals]) Note: This item applies only to those administering their own servers, such as dedicated servers. Users of shared servers are dependent on their hosting provider to set proper database security.)&lt;br /&gt;
&lt;br /&gt;
== Configuring PHP==&lt;br /&gt;
&lt;br /&gt;
===Understand how PHP works===&lt;br /&gt;
: Understand how to work with the php.ini file, and how PHP configurations are controlled. Study the [http://us3.php.net/manual/en/ini.php#ini.list Official List of php.ini Directives] at http://www.php.net, and the well-documented default php.ini file included with every PHP install. Here is the [http://svn.php.net/viewvc/php/php-src/trunk/php.ini-production?view=co latest default php.ini file] on the official PHP site.&lt;br /&gt;
&lt;br /&gt;
===Use PHP5===&lt;br /&gt;
: Currently, both PHP4 and PHP5 are maintained, and both are often available on servers. Before PHP4 becomes obsolete, upgrade your custom scripts to PHP5. Don&#039;t worry about core Joomla code; all current versions are PHP5 compatible. (See [http://www.php.net/ PHP News])&lt;br /&gt;
&lt;br /&gt;
===Use local php.ini files===&lt;br /&gt;
: On shared servers you can&#039;t edit the main php.ini file, but you may be able to add custom, local php.ini files. If so, you&#039;ll need to copy the php.ini files to every sub-directory that requires custom settings. Luckily a [http://tips-scripts.com/free set of scripts at B &amp;amp; T Scripts and Tips] can do the hard work for you.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;There are a few important things to keep in mind.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# Local &#039;&#039;php.ini&#039;&#039; files &#039;&#039;&#039;&#039;&#039;only&#039;&#039;&#039;&#039;&#039; have an effect if your server is configured to use them. This includes a &#039;&#039;php.ini&#039;&#039; file in your &#039;&#039;http_root&#039;&#039; directory. You can test whether or not these file affect your site by setting an obvious directive in the local &#039;&#039;php.ini&#039;&#039; file to see if it affects your site.&lt;br /&gt;
# Local &#039;&#039;php.ini&#039;&#039; files only effect &#039;&#039;.php&#039;&#039; files that are located within the same directory (or included() or required() from those files). This means that there are normally only two Joomla! directories in which you would want to place a &#039;&#039;php.ini&#039;&#039; file. They are your &#039;&#039;http_root&#039;&#039;(your actual directory name may vary), which is where Joomla&#039;s Front-end &#039;&#039;index.php&#039;&#039; file is located, and the Joomla! &#039;&#039;administrator&#039;&#039; directory, which is where the Back-end administrator &#039;&#039;index.php&#039;&#039; file is located. Other directories that don&#039;t have files called via the Web do not need local &#039;&#039;php.ini&#039;&#039; files.&lt;br /&gt;
# If you have a &#039;&#039;php.ini&#039;&#039; file in every directory, some script probably did this for you. If you didn&#039;t intend it to happen, you probably should root them out, but given #2 above, you probably only have to panic about the &#039;&#039;php.ini&#039;&#039; files in &#039;&#039;http_root&#039;&#039; and the &#039;&#039;administrator&#039;&#039; directories.&lt;br /&gt;
&lt;br /&gt;
===Use PHP disable_functions===&lt;br /&gt;
: Use &#039;&#039;disable_functions&#039;&#039; to disable dangerous PHP functions that are not needed by your site. Here is a typical setup for a Joomla! site:&lt;br /&gt;
&lt;br /&gt;
      disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open&lt;br /&gt;
&lt;br /&gt;
===Use PHP open_basedir===&lt;br /&gt;
: &#039;&#039;open_basedir&#039;&#039; should be enabled and correctly configured. This directive limits the files that can be opened by PHP to the specified directory-tree. This directive is NOT affected by whether Safe Mode is ON or OFF. &lt;br /&gt;
&lt;br /&gt;
: The restriction specified with open_basedir is a prefix, not a directory name. This means that &#039;&#039;open_basedir = /dir/incl&#039;&#039; allows access to &#039;&#039;/dir/include&#039;&#039; and &#039;&#039;/dir/incls&#039;&#039; if they exist. To restrict access to only the specified directory, end with a slash. For more information, see [http://us3.php.net/manual/en/features.safe-mode.php#ini.safe-mode PHP Security and Safe Mode Configuration Directives].&lt;br /&gt;
&lt;br /&gt;
     open_basedir = /home/users/you/public_html&lt;br /&gt;
&lt;br /&gt;
: In some system configurations, at least with PHP 4.4.8, the use of the trailing slash to restrict the access to only the specified directory may cause Joomla to warn &#039;&#039;JFolder::create: Infinite loop detected&#039;&#039; when saving the Back-End Global Configuration. This warning is triggered because PHP &#039;&#039;file_exists()&#039;&#039; function fails, for example, when asked if &#039;&#039;/home/user/public_html/joomla_demo&#039;&#039; exists and &#039;&#039;open_basedir&#039;&#039; is set to &#039;&#039;/home/user/public_html/joomla_demo/&#039;&#039; (see the trailing slash).&lt;br /&gt;
&lt;br /&gt;
: Additionally, if &#039;&#039;open_basedir&#039;&#039; is set it may be necessary to set PHP &#039;&#039;upload_tmp_dir&#039;&#039; configuration directive to a path that falls within the scope of &#039;&#039;open_basedir&#039;&#039; or, alternatively, add the &#039;&#039;upload_tmp_dir&#039;&#039; path to &#039;&#039;open_basedir&#039;&#039; using the appropriate path separator for the host system.&lt;br /&gt;
&lt;br /&gt;
     open_basedir = /home/users/you/public_html:/tmp&lt;br /&gt;
&lt;br /&gt;
: PHP will use the system&#039;s temporary directory when &#039;&#039;upload_tmp_dir&#039;&#039; is not set or when it is set but the directory does not exist, therefore it may be necessary to add it to &#039;&#039;open_basedir&#039;&#039; as above to avoid uploading errors within Joomla.&lt;br /&gt;
&lt;br /&gt;
===Adjust magic_quotes_gpc===&lt;br /&gt;
: Adjust the &#039;&#039;magic_quotes_gpc&#039;&#039; directive as needed for your site. The recommended setting for Joomla! 1.0.x is ON to protect against poorly-written third-party extensions. The safest method is to turn &#039;&#039;magic_quotes_gpc&#039;&#039; off and avoid all poorly-written extensions, period. &lt;br /&gt;
&lt;br /&gt;
: Joomla! 1.5 ignores this setting and works fine either way. &lt;br /&gt;
For more information, see either [http://docs.joomla.org/Magic_quotes_and_security Magic quotes and security] or &lt;br /&gt;
[http://us3.php.net/magic_quotes PHP Manual, Chapter 31. Magic Quotes].&lt;br /&gt;
&lt;br /&gt;
      magic_quotes_gpc = 1&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP safe_mode===&lt;br /&gt;
: Avoid the use of PHP safe_mode. This is a valid but incomplete solution to a deeper problem and provides a false sense of security. See the official PHP site for an explanation of this issue.&lt;br /&gt;
&lt;br /&gt;
      safe_mode = 0&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP register_globals===&lt;br /&gt;
: Automatically registering global variables was probably one of the dumbest decisions the developers of PHP made. This directive determines whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables where they become immediately available to all PHP scripts, and where they can easily overwrite your own variable if you&#039;re not careful. Luckily, the PHP developers long since realized the mistake and have depreciated this &#039;feature&#039;. &lt;br /&gt;
&lt;br /&gt;
: If your site is on a shared server with a hosting provider that insists &#039;&#039;register_globals&#039;&#039; must be on, you should be very worried. Although you can often turn register_globals off for your own site with a local php.ini file, this adds little security as other sites on the same server remain vulnerable to attacks which can then launch attacks against your site from within the server. For more information, see [http://www.zend.com/manual/security.globals.php ZEND Chapter 29. Using Register Globals].&lt;br /&gt;
&lt;br /&gt;
      register_globals = 0&lt;br /&gt;
&lt;br /&gt;
===Don&#039;t use PHP allow_url_fopen===&lt;br /&gt;
&lt;br /&gt;
: Don&#039;t use PHP &#039;&#039;allow_url_fopen&#039;&#039;. This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers. Note: This can only be set in php.ini due to security reasons.&lt;br /&gt;
&lt;br /&gt;
      allow_url_fopen = 0&lt;br /&gt;
&lt;br /&gt;
==Setup a backup and recovery process==&lt;br /&gt;
===The most important rule:&#039;===&lt;br /&gt;
: Thou shalt at all time be able to return your site to a previous working state through regular use of a strong, off-site backup and recovery process. Be sure your backup and recovery process is in place and tested BEFORE you go live. This is the single best way (and often the only way) to recover from such inevitable catastrophes as:&lt;br /&gt;
&lt;br /&gt;
# A compromised/cracked site.&lt;br /&gt;
# Broken site due to a faulty upgrade.&lt;br /&gt;
# Hardware failure, such as dead hard drives, power failures, server theft, etc.&lt;br /&gt;
# Authoritarian government intervention. (More common than some think.)&lt;br /&gt;
# Needing to quickly relocate to a new server or hosting provider.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Choose A Checklist==&lt;br /&gt;
# [[Security Checklist 1 - Getting Started|Getting Started]] &lt;br /&gt;
# [[Security Checklist 2 - Hosting and Server Setup|Hosting and Server Setup]]&lt;br /&gt;
# [[Security Checklist 3 - Testing and Development|Testing and Development]]&lt;br /&gt;
# [[Security Checklist 4 - Joomla Setup|Joomla Setup]]&lt;br /&gt;
# [[Security Checklist 5 - Site Administration|Site Administration]]&lt;br /&gt;
# [[Security Checklist 6 - Site Recovery|Site Recovery]]&lt;br /&gt;
&lt;br /&gt;
== Edited by==&lt;br /&gt;
[http://forum.joomla.org/memberlist.php?mode=viewprofile&amp;amp;u=39784 rliskey]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- KEEP THIS AT THE END OF THE PAGE --&amp;gt;&lt;br /&gt;
[[Category:Security Checklist]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Enabling_Search_Engine_Friendly_(SEF)_URLs_on_IIS&amp;diff=50971</id>
		<title>Enabling Search Engine Friendly (SEF) URLs on IIS</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Enabling_Search_Engine_Friendly_(SEF)_URLs_on_IIS&amp;diff=50971"/>
		<updated>2011-04-24T14:26:21Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Fixed syntax errors and updated code to match the code distributed with 1.6.2/1.6.3 onwards.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Under IIS7, a native URL Rewite module is available. It stores rules in a site&#039;s web.config file, expressed in XML format. .htaccess rules can be converted to the web.config format.&lt;br /&gt;
&lt;br /&gt;
Under IIS6, a third-party add-on must be used. Helicon provides one which directly supports .htaccess rules.&lt;br /&gt;
&lt;br /&gt;
==IIS 7 URL Rewriting==&lt;br /&gt;
If you have a server running IIS 7 and PHP, you can take advantage of IIS&#039;s own internal URL rewriting by using a web.config file similar to the one listed below. &lt;br /&gt;
&lt;br /&gt;
You can create the file yourself or use the GUI in the IIS7 Manager. You can import .htaccess rules using the GUI/wizard.&lt;br /&gt;
&lt;br /&gt;
This functionality depends on the presence of the &#039;&#039;&#039;IIS URL Rewrite Module&#039;&#039;&#039;, which does not come with Windows. It is a free download and a Microsoft product.&lt;br /&gt;
&lt;br /&gt;
===GUI===&lt;br /&gt;
If the IIS URL Rewrite module is installed, your website manager will have a tool for &amp;quot;URL Rewrite&amp;quot;, visible in the IIS Manager&#039;s view of your site&#039;s configurable IIS modules. The interface is largely self-explanatory. Regular expressions, wildcards or exact matches are all supported.&lt;br /&gt;
&lt;br /&gt;
===web.config===&lt;br /&gt;
This has been tested on Joomla 1.5 with IIS 7 on Windows Server 2008 with no problems so far. For more information on converting .htaccess to web.config, check out http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
        &amp;lt;rewrite&amp;gt;&lt;br /&gt;
            &amp;lt;rules&amp;gt;&lt;br /&gt;
                &amp;lt;clear /&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Common Exploit Blocking&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;^(.*)$&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAny&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;mosConfig_[a-zA-Z_]{1,21}(=|\%3D)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;base64_encode.*\(.*\)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;(\&amp;amp;lt;|%3C).*script.*(\&amp;gt;|%3E)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;GLOBALS(=|\[|\%[0-9A-Z]{0,2})&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;_REQUEST(=|\[|\%[0-9A-Z]{0,2})&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Redirect&amp;quot; url=&amp;quot;index.php&amp;quot; appendQueryString=&amp;quot;false&amp;quot; redirectType=&amp;quot;SeeOther&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Joomla Search Rule&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;(.*)&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAll&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{URL}&amp;quot; pattern=&amp;quot;^/search.php&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Rewrite&amp;quot; url=&amp;quot;/index.php?option=com_content&amp;amp;amp;view=article&amp;amp;amp;id=4&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Joomla Main Rewrite Rule&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;(.*)&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAll&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{URL}&amp;quot; pattern=&amp;quot;(/[^.]*|\.(php|html?|feed|pdf|raw))$&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{REQUEST_FILENAME}&amp;quot; matchType=&amp;quot;IsFile&amp;quot; negate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{REQUEST_FILENAME}&amp;quot; matchType=&amp;quot;IsDirectory&amp;quot; negate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Rewrite&amp;quot; url=&amp;quot;index.php/&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
            &amp;lt;/rules&amp;gt;&lt;br /&gt;
        &amp;lt;/rewrite&amp;gt;&lt;br /&gt;
        &amp;lt;caching&amp;gt;&lt;br /&gt;
            &amp;lt;profiles&amp;gt;&lt;br /&gt;
                &amp;lt;add extension=&amp;quot;.php&amp;quot; policy=&amp;quot;DisableCache&amp;quot; kernelCachePolicy=&amp;quot;DisableCache&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/profiles&amp;gt;&lt;br /&gt;
        &amp;lt;/caching&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
&amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Helicon ISAPI Rewrite==&lt;br /&gt;
Helicon ISAPI Rewrite 3 located at http://www.helicontech.com/isapi_rewrite/ now provides near identical mod_rewrite functionality.&lt;br /&gt;
&lt;br /&gt;
IIS 7 has its own rewrite module now, the URL Rewrite which works excellent and doesn&#039;t require third party installs. It can be enabled &lt;br /&gt;
through the Web Platform Installer. In the Joomla config turn on both the SEF and Apache mod_rewrite, next create a rule under IIS URL Rewrite:&lt;br /&gt;
Pattern field: &#039;&#039;&#039;^([^/]+)/?$&#039;&#039;&#039;&lt;br /&gt;
Ignore case &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
Action type: &#039;&#039;&#039;Rewrite&#039;&#039;&#039;&lt;br /&gt;
Rewrite URL: &#039;&#039;&#039;index.php/&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The default rewrite rules can be used and the following code inserted to the top of the index.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
if (isset($_SERVER[&#039;HTTP_X_REWRITE_URL&#039;]))&lt;br /&gt;
{&lt;br /&gt;
    $_SERVER[&#039;REQUEST_URI&#039;] = $_SERVER[&#039;HTTP_X_REWRITE_URL&#039;];&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
First job is to install ISAPI rewriter of your choice &lt;br /&gt;
http://www.isapirewrite.com/ or http://cheeso.members.winisp.net/IIRF.aspx&lt;br /&gt;
&lt;br /&gt;
ISAPI ReWrite has a lite version (limited) and IIRF (IonicIsapiRewriter) is freeware always updated and the source is free!&lt;br /&gt;
&lt;br /&gt;
Both are configured via file IsapiRewrite4.ini (you dont need to worry about .htaccess.txt ignore it). (if you are using IIRF IonicIsapiRewriter 2.x see below for a change in filename).&lt;br /&gt;
&lt;br /&gt;
The following entries for ISAPI REWRITE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteLog  D:\temp\iirfLog.out&lt;br /&gt;
RewriteLogLevel 3&lt;br /&gt;
&lt;br /&gt;
IterationLimit 10&lt;br /&gt;
&lt;br /&gt;
# Joomla/Mambo rewrite rules&lt;br /&gt;
RewriteRule  ^/$                      /index.php [L]&lt;br /&gt;
RewriteRule ^/content/blogsection/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=blogsection&amp;amp;id=$1&amp;amp;Itemid=$2 [L]&lt;br /&gt;
RewriteRule ^/content/blogcategory/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=blogcategory&amp;amp;id=$1&amp;amp;Itemid=$2 [L]&lt;br /&gt;
RewriteRule ^/content/section/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=section&amp;amp;id=$1&amp;amp;Itemid=$2 [L]&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5&amp;amp;$6=$7 [L]&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5 [L]&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/ /index.php?option=$1&amp;amp;$2=$3 [L]&lt;br /&gt;
RewriteRule ^/content/category/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=category&amp;amp;sectionid=$1=&amp;amp;id=$2&amp;amp;Itemid=$3 [L]&lt;br /&gt;
RewriteRule ^/content/view/([^/]+)/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=view&amp;amp;id=$1&amp;amp;Itemid=$2&amp;amp;limit=$3&amp;amp;limitstart=$4 [L]&lt;br /&gt;
RewriteRule ^/content/view/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=view&amp;amp;id=$1&amp;amp;Itemid=$2 [L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is for IIRF IonicIsapiRewriter 1.x:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
IterationLimit 10&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remark: If you are using IIRF IonicIsapiRewriter Version 2.x you must have a &amp;quot;global&amp;quot; configuration file in the directory where the DLL is and a site specific file (see Artio JoomSEF below as example) in the Joomla root. The filename for 2.x is no longer IsapiRewrite4.ini but changed to Iirf.ini (!)&lt;br /&gt;
&lt;br /&gt;
Example for IirGlobal.ini:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteFilterPriority MEDIUM&lt;br /&gt;
StatusUrl /iirfStatus  RemoteOK&lt;br /&gt;
# Turn NotifyLog off if you can to optimize speed. If you need to log the original URL turn it on.&lt;br /&gt;
NotifyLog Off&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with ARTIO JoomSEF:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteCond %{HTTP_URL}             (/[^.]*|\.(html?|php))$  [I] &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME}     !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME}     !-d&lt;br /&gt;
RewriteRule (.*)                /index.php                      [U,L]&lt;br /&gt;
# only use the U of the [U,L] if you have turned &amp;quot;NotifyLog ON&amp;quot; specified in your IirGlobal.ini&lt;br /&gt;
MaxMatchCount 10&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with default Joomla SEO:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteRule ^/$                      /index.php [L]&lt;br /&gt;
RewriteRule ^/content/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=$1&amp;amp;id=$2&amp;amp;Itemid=$3&amp;amp;limit=$4&amp;amp;limitstart=$5 [L]&lt;br /&gt;
RewriteRule ^/content/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=$1&amp;amp;id=$2&amp;amp;Itemid=$3 [L]&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5&amp;amp;$6=$7 [L]&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/ /index.php?option=$1&amp;amp;$2=$3 [L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with sh404SEF:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteLogLevel 4 #Make it 0 in to turn debugging off&lt;br /&gt;
RewriteLog c:\IIRfLogfile.log #Write the absolute path of your file here &lt;br /&gt;
&lt;br /&gt;
MaxMatchCount 10&lt;br /&gt;
&lt;br /&gt;
# don&#039;t rewrite any request that goes to administrator&lt;br /&gt;
RewriteRule ^/administrator   -   [L]&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_URL} (/[^.]*|\.(html?|php)|!administrator)$  &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule (.*) /index.php [U,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other Third party SEO should work once to follow there rewrite conditions/rules.&lt;br /&gt;
I run IonicIsapiRewriter-1.2.12b the betas are rock solid and I use it on my production servers with no issues.&lt;br /&gt;
Please follow vendors installation instructions to get the ISAPI filter working on your IIS server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:IIS]][[Category:Tips and tricks]][[Category:Tips and tricks 1.0]][[Category:Tips and tricks 1.5]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=How_do_you_convert_an_htaccess.txt_file_into_a_.htaccess_file%3F&amp;diff=50970</id>
		<title>How do you convert an htaccess.txt file into a .htaccess file?</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=How_do_you_convert_an_htaccess.txt_file_into_a_.htaccess_file%3F&amp;diff=50970"/>
		<updated>2011-04-24T14:16:29Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Additional explanation and clarity.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Introduction===&lt;br /&gt;
&lt;br /&gt;
When using PHP as an Apache module, you can change the configuration settings using directives in Apache configuration files (e.g. httpd.conf and .htaccess files). You will need &amp;quot;AllowOverride Options&amp;quot; or &amp;quot;AllowOverride All&amp;quot; privileges to do so. If you control your own Apache configuration, you can and should use httpd.conf. If you do not control your Apache configuration (such as on a shared server), you must use .htaccess files.&lt;br /&gt;
&lt;br /&gt;
===Directions===&lt;br /&gt;
&lt;br /&gt;
# First look for the file, htaccess.txt in your root directory using FTP to connect to your server. The file should have been installed during the Joomla! installation. (Note that this file name does not begin with a dot.) Open and carefully read htaccess.txt. It contains important suggestions on how to protect your site.&lt;br /&gt;
# Make any adjustments to this file as appropriate for your site, and then save it in your site&#039;s home directory as, .htaccess (including the dot). Make sure you uncheck the &amp;quot;Hide filenames that begin with a period&amp;quot; option within your FTP program.&lt;br /&gt;
# Test your site&#039;s front end and back end. If it produces errors, rename the file back to htaccess.txt, and troubleshoot your edits. If you are unable to get this working, you may have to leave the file named as htaccess.txt.&lt;br /&gt;
# Use phpinfo() to ensure that all configurations set as you intended. Note: Web-accessible files that include phpinfo() are potential security risks they offer attackers lots of useful information about your server. Always remove such files after use.&lt;br /&gt;
&lt;br /&gt;
===More Information===&lt;br /&gt;
* [http://us2.php.net/configuration.changes Official PHP Manual: How to change configuration settings]&lt;br /&gt;
* [http://us2.php.net/manual/en/ini.php#ini.list Official PHP Manual: List of PHP INI directives]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Administration FAQ]]&lt;br /&gt;
[[Category:Getting Started FAQ]]&lt;br /&gt;
[[Category:Version 1.5 FAQ]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Global Configuration Management]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=How_can_you_check_if_mod_rewrite_is_enabled%3F&amp;diff=50969</id>
		<title>How can you check if mod rewrite is enabled?</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=How_can_you_check_if_mod_rewrite_is_enabled%3F&amp;diff=50969"/>
		<updated>2011-04-24T13:33:42Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Duplicate page, redirected this copy...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[How to check if mod rewrite is enabled on your server]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=How_to_check_if_mod_rewrite_is_enabled_on_your_server&amp;diff=50968</id>
		<title>How to check if mod rewrite is enabled on your server</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=How_to_check_if_mod_rewrite_is_enabled_on_your_server&amp;diff=50968"/>
		<updated>2011-04-24T13:24:11Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Using the &amp;quot;Redirect&amp;quot; directive cannot prove whether mod_rewrite is installed. Redirect is a part of mod_alias not mod_rewrite.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Many problems with SEO arise from the fact that a host has not enabled mod_rewrite (Apache setting) on the servers. They often tell you they have (while they have not). You can verify if this is correct or not and if this is causing your server to issue HTTP Error 500.&lt;br /&gt;
&lt;br /&gt;
Here is how to check if mod-rewrite is really enabled!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;1. Enable SEO in your administrator:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In Joomla 1.0: Site -&amp;gt; Global Configuration -&amp;gt; SEO: Search Engine Friendly URLs to Yes.&lt;br /&gt;
&lt;br /&gt;
In Joomla 1.5: Site -&amp;gt; Global Configuration -&amp;gt; Site: Search Engine Friendly URLs to Yes, Use Apache mod_rewrite to Yes. (Setting Add suffix to URLs is optional).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;2. Rename your htaccess.txt to .htaccess:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Next place ONLY the following lines in your .htaccess:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
RewriteRule ^joomla\.html http://www.joomla.org/? [R=301,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;3. Now point your browser to:&#039;&#039;&#039; http://www.example.com/joomla.html&lt;br /&gt;
&lt;br /&gt;
(Replace www.example.com with your own domain name in the URL above.)&lt;br /&gt;
&lt;br /&gt;
If it redirects you to joomla.org then mod_rewrite is working.&lt;br /&gt;
If it gives you an error then mod_rewrite is not working.&lt;br /&gt;
&lt;br /&gt;
Note: if your site is located in a folder such as &amp;quot;/test/&amp;quot; you need to insert the code in the root .htaccess file as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
RewriteRule ^test/joomla\.html http://www.joomla.org/? [R=301,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Tips and tricks]]&lt;br /&gt;
[[Category:Tips and tricks 1.0]]&lt;br /&gt;
[[Category:Tips and tricks 1.5]]&lt;br /&gt;
[[Category:FAQ]][[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48984</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48984"/>
		<updated>2011-04-23T23:33:40Z</updated>

		<summary type="html">&lt;p&gt;G1smd: URLs updated.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
## If you disable the back-end protection above, please add this line:&lt;br /&gt;
# RewriteRule ^administrator/index[23]?\.php$ - [L]&lt;br /&gt;
RewriteRule ^([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4314051/diff/1001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4430062/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48682</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48682"/>
		<updated>2011-04-23T10:51:33Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.8 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^/]+/)*([^/.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
## If you disable the back-end protection above, please add this line:&lt;br /&gt;
# RewriteRule ^administrator/index[23]?\.php$ - [L]&lt;br /&gt;
RewriteRule ^([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48681</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48681"/>
		<updated>2011-04-23T10:14:06Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.7 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 10th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 10th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/([^.]+\.)+php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
## If you disable the back-end protection above, please add this line:&lt;br /&gt;
# RewriteRule ^administrator/index[23]?\.php$ - [L]&lt;br /&gt;
RewriteRule ^([^/.]+\.)+php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48680</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=48680"/>
		<updated>2011-04-23T10:12:08Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.6 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 9th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 9th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/[^.]+\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39779</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39779"/>
		<updated>2011-04-17T18:05:21Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.6 with more changes. Many logic errors as well as a number of typos have been corrected in this and recent versions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 10th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 10th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in www.olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.1&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 3.1 - April 2011&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting the&lt;br /&gt;
## dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/[^.]+\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39523</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39523"/>
		<updated>2011-04-11T23:27:13Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Updated some URLs.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 8th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 8th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/[^.]+\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://code.google.com/p/joomla-master-htaccess/source/list and at: http://akeeba.assembla.com/code/master-htaccess/git/node/logs&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4290071/diff/8001/joomla-master-htaccess.txt&lt;br /&gt;
http://codereview.appspot.com/4370051/diff/3/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39506</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=39506"/>
		<updated>2011-04-11T23:15:23Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.5 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 8th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 8th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
## If the above doesn&#039;t work on your server, try this:&lt;br /&gt;
## RewriteRule ^mail http://mail.google.com/a/example.com [R,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/[^.]+\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38568</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38568"/>
		<updated>2011-04-10T07:22:28Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.4 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 7th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 7th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
## Uncomment the following line to enable:&lt;br /&gt;
# RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to /&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to /&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^www\. [NC]&lt;br /&gt;
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]&lt;br /&gt;
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]&lt;br /&gt;
## If the above throws an HTTP 500 error, swap [R=301,L] with [R,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
## Uncomment the following lines to enable:&lt;br /&gt;
# RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
# RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule. You need BOTH LINES PER URL for the rule&lt;br /&gt;
# to work.&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
## Alternatively, comment the above line and uncomment the following line:&lt;br /&gt;
# RewriteCond %{HTTPS} ^off$ [NC]&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
## NOTE: If you get an HTTP 500 error, please swap [R=301,L] with [R,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
# (these attacks wouldn&#039;t work w/out Joomla! 1.5&#039;s Legacy Mode plugin)&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
## IMPORTANT: If the above line throws an HTTP 500 error, replace it with these 2 lines:&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_encode\(.*\) [OR]&lt;br /&gt;
# RewriteCond %{QUERY_STRING} base64_decode\(.*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain name.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteRule \.(jp(e?g|2)?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/[^.]+\.(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
## Uncomment this line if you have extensions which require direct access to their own&lt;br /&gt;
## custom index.php files. Note that this is UNSAFE and the developer should be ashamed&lt;br /&gt;
## for being so lame, lazy and security unconscious.&lt;br /&gt;
# RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)?$ - [L]&lt;br /&gt;
## Uncomment the following line if your template requires direct access to PHP files&lt;br /&gt;
## inside its directory, e.g. GZip compressed copies of its CSS files&lt;br /&gt;
# RewriteRule ^templates/[^.]+\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38173</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38173"/>
		<updated>2011-04-03T00:11:17Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.3 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - April 2nd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (April 2nd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
# RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.\//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json|file))$ [NC] &lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38172</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38172"/>
		<updated>2011-04-02T23:52:55Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.2 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 30th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 30th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
# RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.\//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json|file))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38148</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38148"/>
		<updated>2011-03-31T23:16:21Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Proposed file for version 2.4.2 with more changes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 30th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## Additional thank-yous to John for his remarks and g1smd for taking the&lt;br /&gt;
## time to optimize the speed of the file.&lt;br /&gt;
##&lt;br /&gt;
## It is usually prudent to remove the comments from the file when using it&lt;br /&gt;
## on a live host to minimize the parsing time.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 30th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
# This line also disables Akeeba Remote Control 2.5 and earlier&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
# WARNING: Disabling wget will also block the most common method for&lt;br /&gt;
# running CRON jobs. Remove if you have issues with CRON jobs.&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
# If the above line throws a 500 error, change [R=301,L] to [R,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
# RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
# RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
## Note: Replace [R=301,L] with [R,L] if you get error 500.&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.\//?)+ [OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 3.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php$ - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php$ - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php$ - [L]&lt;br /&gt;
## Allow Akeeba Kickstart&lt;br /&gt;
RewriteRule ^kickstart\.php$ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=(component|system) [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)t(p|emplate|mpl)= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow rogue scripts in your site&#039;s root&lt;br /&gt;
# Exception: Allow Joomla!&#039;s index.php and index2.php files&lt;br /&gt;
RewriteRule ^index2?\.php$ - [L]&lt;br /&gt;
RewriteRule ^[^.]+\.php$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x.&lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The previous lines are a &amp;quot;compressed&amp;quot; version&lt;br /&gt;
## of the filters. You can add your own filters as:&lt;br /&gt;
## RewriteCond %{QUERY_STRING} \bbadword\b [NC,OR]&lt;br /&gt;
## where &amp;quot;badword&amp;quot; is the word you want to exclude.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38114</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38114"/>
		<updated>2011-03-28T10:37:52Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Version 2.4.1 is the current stable version of the master .htaccess file. Working towards version 3.0 for release some time in April 2011.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4.1 - March 24th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4.1 (March 24th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38113</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38113"/>
		<updated>2011-03-28T10:36:47Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Version 2.4.1 is the current stable version of the master .htaccess file.  Working towards version 3.0 for release some time in April 2011.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4.1 - March 24th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 24th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38092</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38092"/>
		<updated>2011-03-25T09:45:45Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Updates to footer notes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 24th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 24th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess Proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010 to v2.3) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
The original file contains a number of syntax errors, several rules that can never work, and a number of expressions that can be more efficiently coded.&lt;br /&gt;
&lt;br /&gt;
Bugs and enhancements originally discussed at: http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841&lt;br /&gt;
&lt;br /&gt;
Discussion also at: http://snipt.net/nikosdion/the-master-htaccess/&lt;br /&gt;
&lt;br /&gt;
The new proposed file: http://snipt.net/g1smd/joomla-master-htaccess-file-proposed-v24-2011-03-24/ or at http://code.google.com/p/joomla-master-htaccess/source/list&lt;br /&gt;
&lt;br /&gt;
The changes explained, line by line: http://codereview.appspot.com/4312049/diff/1/joomla-master-htaccess.txt&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38088</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38088"/>
		<updated>2011-03-24T20:51:09Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Correction to image file extension pattern matching.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 24th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 24th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe?[g2]?|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38086</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38086"/>
		<updated>2011-03-24T08:43:14Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Master File copied to original author &amp;quot;as is&amp;quot; and posted to snipt as &amp;quot;proposed v2.4&amp;quot; (2011-03-24).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 24th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 24th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Enabling_Search_Engine_Friendly_(SEF)_URLs_on_IIS&amp;diff=38083</id>
		<title>Enabling Search Engine Friendly (SEF) URLs on IIS</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Enabling_Search_Engine_Friendly_(SEF)_URLs_on_IIS&amp;diff=38083"/>
		<updated>2011-03-23T23:24:19Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Minor optimisation of patterns.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Under IIS7, a native URL Rewite module is available. It stores rules in a site&#039;s web.config file, expressed in XML format. .htaccess rules can be converted to the web.config format.&lt;br /&gt;
&lt;br /&gt;
Under IIS6, a third-party add-on must be used. Helicon provides one which directly supports .htaccess rules.&lt;br /&gt;
&lt;br /&gt;
==IIS 7 URL Rewriting==&lt;br /&gt;
If you have a server running IIS 7 and PHP, you can take advantage of IIS&#039;s own internal URL rewriting by using a web.config file similar to the one listed below. &lt;br /&gt;
&lt;br /&gt;
You can create the file yourself or use the GUI in the IIS7 Manager. You can import .htaccess rules using the GUI/wizard.&lt;br /&gt;
&lt;br /&gt;
This functionality depends on the presence of the &#039;&#039;&#039;IIS URL Rewrite Module&#039;&#039;&#039;, which does not come with Windows. It is a free download and a Microsoft product.&lt;br /&gt;
&lt;br /&gt;
===GUI===&lt;br /&gt;
If the IIS URL Rewrite module is installed, your website manager will have a tool for &amp;quot;URL Rewrite&amp;quot;, visible in the IIS Manager&#039;s view of your site&#039;s configurable IIS modules. The interface is largely self-explanatory. Regular expressions, wildcards or exact matches are all supported.&lt;br /&gt;
&lt;br /&gt;
===web.config===&lt;br /&gt;
This has been tested on Joomla 1.5 with IIS 7 on Windows Server 2008 with no problems so far. For more information on converting .htaccess to web.config, check out http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;configuration&amp;gt;&lt;br /&gt;
    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;
        &amp;lt;rewrite&amp;gt;&lt;br /&gt;
            &amp;lt;rules&amp;gt;&lt;br /&gt;
                &amp;lt;clear /&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Common Exploit Blocking&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;^(.*)$&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAny&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;mosConfig_[a-zA-Z_]{1,21}(=|\%3D)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;base64_encode.*\(.*\)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;(\&amp;amp;lt;|%3C).*script.*(\&amp;gt;|%3E)&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;GLOBALS(=|\[|\%[0-9A-Z]{0,2})&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{QUERY_STRING}&amp;quot; pattern=&amp;quot;_REQUEST(=|\[|\%[0-9A-Z]{0,2})&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Redirect&amp;quot; url=&amp;quot;index.php&amp;quot; appendQueryString=&amp;quot;false&amp;quot; redirectType=&amp;quot;SeeOther&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Joomla Search Rule&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;(.*)&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAll&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{URL}&amp;quot; pattern=&amp;quot;^/search.php&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Rewrite&amp;quot; url=&amp;quot;/index.php?option=com_content&amp;amp;amp;view=article&amp;amp;amp;id=4&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
                &amp;lt;rule name=&amp;quot;Joomla Main Rewrite Rule&amp;quot; stopProcessing=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;match url=&amp;quot;(.*)&amp;quot; ignoreCase=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;conditions logicalGrouping=&amp;quot;MatchAll&amp;quot;&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{REQUEST_FILENAME}&amp;quot; matchType=&amp;quot;IsFile&amp;quot; negate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{REQUEST_FILENAME}&amp;quot; matchType=&amp;quot;IsDirectory&amp;quot; negate=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;
                        &amp;lt;add input=&amp;quot;{URL}&amp;quot; pattern=&amp;quot;(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$&amp;quot; /&amp;gt;&lt;br /&gt;
                    &amp;lt;/conditions&amp;gt;&lt;br /&gt;
                    &amp;lt;action type=&amp;quot;Rewrite&amp;quot; url=&amp;quot;index.php/&amp;quot; /&amp;gt;&lt;br /&gt;
                &amp;lt;/rule&amp;gt;&lt;br /&gt;
            &amp;lt;/rules&amp;gt;&lt;br /&gt;
        &amp;lt;/rewrite&amp;gt;&lt;br /&gt;
        &amp;lt;caching&amp;gt;&lt;br /&gt;
            &amp;lt;profiles&amp;gt;&lt;br /&gt;
                &amp;lt;add extension=&amp;quot;.php&amp;quot; policy=&amp;quot;DisableCache&amp;quot; kernelCachePolicy=&amp;quot;DisableCache&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;/profiles&amp;gt;&lt;br /&gt;
        &amp;lt;/caching&amp;gt;&lt;br /&gt;
    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;
&amp;lt;/configuration&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Helicon ISAPI Rewrite==&lt;br /&gt;
Helicon ISAPI Rewrite 3 located at http://www.helicontech.com/isapi_rewrite/ now provides near identical mod_rewrite functionality.&lt;br /&gt;
&lt;br /&gt;
IIS 7 has its own rewrite module now, the URL Rewrite which works excellent and doesn&#039;t require third party installs. It can be enabled &lt;br /&gt;
through the Web Platform Installer. In the Joomla config turn on both the SEF and Apache mod_rewrite, next create a rule under IIS URL Rewrite:&lt;br /&gt;
Pattern field: &#039;&#039;&#039;^([^/]+)/?$&#039;&#039;&#039;&lt;br /&gt;
Ignore case &#039;&#039;&#039;ON&#039;&#039;&#039;&lt;br /&gt;
Action type: &#039;&#039;&#039;Rewrite&#039;&#039;&#039;&lt;br /&gt;
Rewrite URL: &#039;&#039;&#039;index.php/&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The default rewrite rules can be used and the following code inserted to the top of the index.php file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
if (isset($_SERVER[&#039;HTTP_X_REWRITE_URL&#039;]))&lt;br /&gt;
{&lt;br /&gt;
    $_SERVER[&#039;REQUEST_URI&#039;] = $_SERVER[&#039;HTTP_X_REWRITE_URL&#039;];&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
First job is to install ISAPI rewriter of your choice &lt;br /&gt;
http://www.isapirewrite.com/ or http://cheeso.members.winisp.net/IIRF.aspx&lt;br /&gt;
&lt;br /&gt;
ISAPI ReWrite has a lite version (limited) and IIRF (IonicIsapiRewriter) is freeware always updated and the source is free!&lt;br /&gt;
&lt;br /&gt;
Both are configured via file IsapiRewrite4.ini (you dont need to worry about .htaccess.txt ignore it). (if you are using IIRF IonicIsapiRewriter 2.x see below for a change in filename).&lt;br /&gt;
&lt;br /&gt;
The following entries for ISAPI REWRITE:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteLog  D:\temp\iirfLog.out&lt;br /&gt;
RewriteLogLevel 3&lt;br /&gt;
&lt;br /&gt;
IterationLimit 10&lt;br /&gt;
&lt;br /&gt;
# Joomla/Mambo rewrite rules&lt;br /&gt;
RewriteRule  ^/$                      /index.php&lt;br /&gt;
RewriteRule ^/content/blogsection/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=blogsection&amp;amp;id=$1&amp;amp;Itemid=$2&lt;br /&gt;
RewriteRule ^/content/blogcategory/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=blogcategory&amp;amp;id=$1&amp;amp;Itemid=$2&lt;br /&gt;
RewriteRule ^/content/section/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=section&amp;amp;id=$1&amp;amp;Itemid=$2&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5&amp;amp;$6=$7&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/ /index.php?option=$1&amp;amp;$2=$3&lt;br /&gt;
RewriteRule ^/content/category/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=category&amp;amp;sectionid=$1=&amp;amp;id=$2&amp;amp;Itemid=$3&lt;br /&gt;
RewriteRule ^/content/view/([^/]+)/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=view&amp;amp;id=$1&amp;amp;Itemid=$2&amp;amp;limit=$3&amp;amp;limitstart=$4&lt;br /&gt;
RewriteRule ^/content/view/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=view&amp;amp;id=$1&amp;amp;Itemid=$2&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is for IIRF IonicIsapiRewriter 1.x:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
IterationLimit 10&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remark: If you are using IIRF IonicIsapiRewriter Version 2.x you must have a &amp;quot;global&amp;quot; configuration file in the directory where the DLL is and a site specific file (see Artio JoomSEF below as example) in the Joomla root. The filename for 2.x is no longer IsapiRewrite4.ini but changed to Iirf.ini (!)&lt;br /&gt;
&lt;br /&gt;
Example for IirGlobal.ini:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteFilterPriority MEDIUM&lt;br /&gt;
StatusUrl /iirfStatus  RemoteOk&lt;br /&gt;
# Turn NotifyLog off if you can to optimize speed. If you need to log the original URL turn it on.&lt;br /&gt;
NotifyLog Off&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with ARTIO JoomSEF:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteCond %{HTTP_URL}             (/|\.html?|\.php|/[^.]*)$  [I] &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME}     !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME}     !-d&lt;br /&gt;
RewriteRule (.*)                /index.php                      [U,L]&lt;br /&gt;
# only use the U of the [U,L] if you have turned &amp;quot;NotifyLog ON&amp;quot; specified in your IirGlobal.ini&lt;br /&gt;
MaxMatchCount 10&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with default Joomla SEO:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteRule ^/$                      /index.php&lt;br /&gt;
RewriteRule ^/content/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=$1&amp;amp;id=$2&amp;amp;Itemid=$3&amp;amp;limit=$4&amp;amp;limitstart=$5&lt;br /&gt;
RewriteRule ^/content/([^/]+)/([^/]+)/([^/]+)/ /index.php?option=com_content&amp;amp;task=$1&amp;amp;id=$2&amp;amp;Itemid=$3&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+)/([^/]+),([^/]+) /index.php?option=$1&amp;amp;$2=$3&amp;amp;$4=$5&amp;amp;$6=$7&lt;br /&gt;
RewriteRule ^/component/option,([^/]+)/([^/]+),([^/]+)/ /index.php?option=$1&amp;amp;$2=$3 &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tested and working with sh404SEF:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
RewriteLogLevel 4 #Make it 0 in to turn debugging off&lt;br /&gt;
RewriteLog c:\IIRfLogfile.log #Write the absolute path of your file here &lt;br /&gt;
&lt;br /&gt;
MaxMatchCount 10&lt;br /&gt;
&lt;br /&gt;
# don&#039;t rewrite any request that goes to administrator&lt;br /&gt;
RewriteRule ^/administrator   -   [L]&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{HTTP_URL} (/|\.html?|\.php|!administrator|/[^.]*)$  &lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule (.*) /index.php [U,L]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other Third party SEO should work once to follow there rewrite conditions/rules.&lt;br /&gt;
I run IonicIsapiRewriter-1.2.12b the betas are rock solid and I use it on my production servers with no issues.&lt;br /&gt;
Please follow vendors installation instructions to get the ISAPI filter working on your IIS server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;[[Category:IIS]][[Category:Tips and tricks]][[Category:Tips and tricks 1.0]][[Category:Tips and tricks 1.5]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38082</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38082"/>
		<updated>2011-03-23T20:21:36Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Tidy up various comments.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 ## Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&lt;br /&gt;
 # Return 403 Forbidden error.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 23rd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 23rd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38081</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38081"/>
		<updated>2011-03-23T20:15:46Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Removed section that is already included in the production Joomla .htaccess file, and for which a slightly improved version is offered in the suggested &amp;#039;Master htaccess file&amp;#039;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 23rd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 23rd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38080</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38080"/>
		<updated>2011-03-23T19:40:24Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Added comments.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 23rd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 23rd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
#&lt;br /&gt;
# If the requested path and file is not /index.php and the request&lt;br /&gt;
# has not already been internally rewritten to the index.php script&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
# and the request is for the site root, or for an extensionless URL,&lt;br /&gt;
# or the requested URL ends with one of the listed extensions&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
# and the requested path and file doesn&#039;t directly match a physical file&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
# and the requested path doesn&#039;t directly match a physical folder&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
# internally rewrite the request to the index.php script&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38076</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38076"/>
		<updated>2011-03-23T09:25:59Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Incorrect use of &amp;quot;=&amp;quot; sign meant rule was looking for literal string not input matching a pattern.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 22nd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 22nd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38070</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38070"/>
		<updated>2011-03-23T00:38:35Z</updated>

		<summary type="html">&lt;p&gt;G1smd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 22nd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 22nd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38069</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38069"/>
		<updated>2011-03-23T00:36:43Z</updated>

		<summary type="html">&lt;p&gt;G1smd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 22nd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 22nd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38068</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38068"/>
		<updated>2011-03-23T00:12:02Z</updated>

		<summary type="html">&lt;p&gt;G1smd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 22nd, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 22nd, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38067</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38067"/>
		<updated>2011-03-23T00:03:13Z</updated>

		<summary type="html">&lt;p&gt;G1smd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38066</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38066"/>
		<updated>2011-03-22T23:12:00Z</updated>

		<summary type="html">&lt;p&gt;G1smd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38064</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38064"/>
		<updated>2011-03-22T23:06:02Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Minor edits to comments.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 #&lt;br /&gt;
 # Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 #&lt;br /&gt;
 ########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request query string contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base64_decode data within the URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38035</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38035"/>
		<updated>2011-03-19T21:20:21Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Typo fixed.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)|[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38034</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38034"/>
		<updated>2011-03-19T18:30:34Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Preserve http/https protocol in the redirect.  Solves http://forum.joomla.org/viewtopic.php?p=2448764#p2448764&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteCond %{SERVER_PORT}&amp;gt;s ^(443&amp;gt;(s)¦[0-9]+&amp;gt;s)$&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http%2://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38033</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38033"/>
		<updated>2011-03-19T18:24:59Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Allow both http and https referrer. Good catch!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38027</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38027"/>
		<updated>2011-03-18T19:46:20Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Updated text to clarify what actually happens.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38016</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38016"/>
		<updated>2011-03-17T07:57:07Z</updated>

		<summary type="html">&lt;p&gt;G1smd: mod_deflate is Apache 2 module.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Send all blocked request to homepage with 403 Forbidden error!&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# mod_deflate is not available on Apache 1.x series. Can only be used with Apache 2.x server. &lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return a 403 Forbidden&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38013</id>
		<title>Htaccess examples (security)</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Htaccess_examples_(security)&amp;diff=38013"/>
		<updated>2011-03-16T19:23:13Z</updated>

		<summary type="html">&lt;p&gt;G1smd: Allow blank REFERER.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&#039;&#039;Credit for part of this .htaccess file goes to Ronald van den Heetkamp&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For this to work you need RewriteEngine set to On, and will likely also need Options +FollowSymLinks too:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 # mod_rewrite in use&lt;br /&gt;
 RewriteEngine On&lt;br /&gt;
 Options +FollowSymLinks&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rewrite rules to block out some common exploits ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
 ## If you experience problems on your site block out the operations listed below&lt;br /&gt;
 ## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
 ## Block out any script trying to set a mosConfig value through the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
 # Block out any script trying to base64_encode data within the URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]&lt;br /&gt;
 # Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
 # Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
 # Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
 RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
 # Send all blocked request to homepage with 403 Forbidden error!&lt;br /&gt;
 RewriteRule .* index.php [F]&lt;br /&gt;
 ########### End - Rewrite rules to block out some common exploits&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Block bad user agents ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ########## Block bad user agents&lt;br /&gt;
 ## The following list may include bots that no longer exist or are not a problem&lt;br /&gt;
 ## for your site. The list will always be incomplete and it is therefore wise to&lt;br /&gt;
 ## follow discussions on one of the many &amp;quot;security&amp;quot; mailing lists or on a forum&lt;br /&gt;
 ## such as http://www.webmasterworld.com/search_engine_spiders/&lt;br /&gt;
 ## It is also unwise to rely on this list as your ONLY security mechanism.&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^Zeus&lt;br /&gt;
 RewriteRule .* - [F]&lt;br /&gt;
 ## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other useful settings ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
 ServerSignature Off&lt;br /&gt;
 RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]&lt;br /&gt;
 RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_REFERER} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_COOKIE} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 RewriteCond %{REQUEST_URI} ^/(,|;|:|&amp;lt;|&amp;gt;|”&amp;gt;|”&amp;lt;|/|\\\.\.\\).{0,9999} [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^$ [OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]&lt;br /&gt;
 RewriteCond %{HTTP_USER_AGENT} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]&lt;br /&gt;
 &lt;br /&gt;
 #Block mySQL injects&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (;|&amp;lt;|&amp;gt;|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.\./\.\. [OR]&lt;br /&gt;
&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]&lt;br /&gt;
 RewriteCond %{QUERY_STRING} (&amp;lt;|&amp;gt;|’|%0A|%0D|%27|%3C|%3E|%00) [NC]&lt;br /&gt;
 # Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: Rewrite conditions need to be followed by a rewrite rule, such as:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
# Return 403 Forbidden header and show the content of the root homepage.&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Suggested Master htaccess file ==&lt;br /&gt;
&lt;br /&gt;
This can be discussed in [http://forum.joomla.org/viewtopic.php?f=432&amp;amp;t=549841 this forum topic]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning: note the hashed areas. Incorrect settings on some servers may cause 500 page errors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
###############################################################################&lt;br /&gt;
## The Master .htaccess&lt;br /&gt;
##&lt;br /&gt;
## Version 2.4 (proposed) - March 16th, 2011&lt;br /&gt;
##&lt;br /&gt;
## ----------&lt;br /&gt;
## This file is designed to be the template .htaccess file to put on your new&lt;br /&gt;
## sites, increasing your site&#039;s security and performance. It is not meant to&lt;br /&gt;
## be just dropped in your site, though. You should go through all of its&lt;br /&gt;
## sections and modify it to match your site. Most notably, all instances of&lt;br /&gt;
## example.com and example\.com should be replaced with your real domain name.&lt;br /&gt;
##&lt;br /&gt;
## Some sections are too picky and may cause problems with legitimate requests.&lt;br /&gt;
## You are ultimately responsible for disabling them or writing exception rules&lt;br /&gt;
## for your requests. Most notably, the advanced server protection section will&lt;br /&gt;
## cause issues with several minifiers, eXtplorer, VirtueMart and other exten-&lt;br /&gt;
## sions which use non-standard scripts as their entry points. You must add&lt;br /&gt;
## exceptions for them manually.&lt;br /&gt;
##&lt;br /&gt;
## Some sections - depending on your server configuration - may cause your site&lt;br /&gt;
## to throw 500 Internal Server Error. The only way to figure out which one is&lt;br /&gt;
## causing it is trial and error.&lt;br /&gt;
##&lt;br /&gt;
## Big thank you&#039;s to Brian Teeman, Ken Crowder, Radek Suski and Fotis&lt;br /&gt;
## Evangelou for sharing their .htaccess rules with the world and inspiring&lt;br /&gt;
## the creation of this file. Special thanks to Jon Brown for sharing his&lt;br /&gt;
## research and helping me improve this file.&lt;br /&gt;
##&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
## Do you want to customize this .htaccess file with a few clicks?&lt;br /&gt;
## Admin Tools Professional by AkeebaBackup.com does this and much more.&lt;br /&gt;
##&lt;br /&gt;
## Learn more: http://www.akeebabackup.com/software/admin-tools.html&lt;br /&gt;
## ----------------------------------------------------------------------&lt;br /&gt;
##&lt;br /&gt;
## Have fun, stay safe.&lt;br /&gt;
##&lt;br /&gt;
## Nicholas K. Dionysopoulos&lt;br /&gt;
## Lead Developer, AkeebaBackup.com&lt;br /&gt;
##&lt;br /&gt;
## CHANGELOG:&lt;br /&gt;
## Version 2.4 (proposed) (March 16th, 2011)&lt;br /&gt;
## - Dozens of speed optimisations and many logic and syntax corrections.&lt;br /&gt;
## Version 2.3 (November 18th, 2010)&lt;br /&gt;
## - Added .ico to the pass-through rules, for favicons to load&lt;br /&gt;
## Version 2.2 (October 25th, 2010)&lt;br /&gt;
## - Bug in the tmpl=component rule&lt;br /&gt;
## Version 2.1 (October 19th, 2010)&lt;br /&gt;
## - index.php to root redirection would kill some AJAX requests&lt;br /&gt;
## - Referer filtering was screwed up&lt;br /&gt;
## - Simplified and more thorough PHP Easter Egg code (thanks Jon!)&lt;br /&gt;
## - The tp/template/tmpl filter was not thorough and killed some components&lt;br /&gt;
## - Optimized Joomla! core SEF section&lt;br /&gt;
## - Bot filters and GZip optimization would never run for dynamic content&lt;br /&gt;
## - Content expiration optimization got more optimized&lt;br /&gt;
## - Added ETag rule&lt;br /&gt;
##&lt;br /&gt;
###############################################################################&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteEngine enabled&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
Options +FollowSymLinks&lt;br /&gt;
########## End - RewriteEngine enabled&lt;br /&gt;
&lt;br /&gt;
########## Begin - RewriteBase&lt;br /&gt;
# Uncomment following line if your webserver&#039;s URL&lt;br /&gt;
# is not directly related to physical file paths.&lt;br /&gt;
# Update Your Joomla! Directory (just / for root)&lt;br /&gt;
&lt;br /&gt;
# RewriteBase /&lt;br /&gt;
########## End - RewriteBase&lt;br /&gt;
&lt;br /&gt;
########## Begin - File execution order, by Komra.de&lt;br /&gt;
DirectoryIndex index.php index.html&lt;br /&gt;
########## End - File execution order&lt;br /&gt;
&lt;br /&gt;
########## Begin - No directory listings&lt;br /&gt;
## Note: +FollowSymlinks may cause problems and you might have to remove it&lt;br /&gt;
IndexIgnore *&lt;br /&gt;
Options +FollowSymLinks All -Indexes&lt;br /&gt;
########## End - No directory listings&lt;br /&gt;
&lt;br /&gt;
########## Begin - ETag Optimization&lt;br /&gt;
## This rule will create an ETag for files based only on the modification&lt;br /&gt;
## timestamp and their size. This works wonders if you are using rsync&#039;ed&lt;br /&gt;
## servers, where the inode number of identical files differs.&lt;br /&gt;
## Note: It may cause problems on your server and you may need to remove it&lt;br /&gt;
FileETag MTime Size&lt;br /&gt;
########## End - ETag Optimization&lt;br /&gt;
&lt;br /&gt;
########## Begin - Optimal default expiration time&lt;br /&gt;
## Note: this might cause problems and you might have to comment it out by&lt;br /&gt;
## placing a hash in front of this section&#039;s lines&lt;br /&gt;
&amp;lt;IfModule mod_expires.c&amp;gt;&lt;br /&gt;
   # Enable expiration control&lt;br /&gt;
   ExpiresActive On&lt;br /&gt;
&lt;br /&gt;
   # Default expiration: 1 hour after request&lt;br /&gt;
   ExpiresDefault &amp;quot;now plus 1 hour&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # CSS and JS expiration: 1 week after request&lt;br /&gt;
   ExpiresByType text/css &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
   ExpiresByType application/x-javascript &amp;quot;now plus 1 week&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Image files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType image/bmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/gif &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/jp2 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/pipeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/png &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/svg+xml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/tiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.microsoft.icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/x-icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/icon &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType text/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/ico &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType image/vnd.wap.wbmp &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/vnd.wap.wbxml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType application/smil &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Audio files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType audio/basic &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mid &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/midi &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-aiff &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-mpegurl &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-pn-realaudio &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType audio/x-wav &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   # Movie files expiration: 1 month after request&lt;br /&gt;
   ExpiresByType application/x-shockwave-flash &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType x-world/x-vrml &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-msvideo &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mpeg &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/mp4 &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/quicktime &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-la-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
   ExpiresByType video/x-ms-asf &amp;quot;now plus 1 month&amp;quot;&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
########## End - Optimal expiration time&lt;br /&gt;
&lt;br /&gt;
########## Begin - Common hacking tools and bandwidth hoggers block&lt;br /&gt;
## By SigSiu.net and @nikosdion.&lt;br /&gt;
## WARNING: This will also block old versions of JoomlaPack Remote&lt;br /&gt;
## and will disallow running CRON jobs using wget.&lt;br /&gt;
# The following rules are for common hacking tools:&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Indy Library&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;libwww-perl&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Wget&amp;quot; stayout=1&lt;br /&gt;
# The following rules are for bandwidth-hogging download tools&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Download Demon&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetRight&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GetWeb!&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go!Zilla&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;Go-Ahead-Got-It&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;GrabNet&amp;quot; stayout=1&lt;br /&gt;
SetEnvIf user-agent &amp;quot;TurnitinBot&amp;quot; stayout=1&lt;br /&gt;
# This line denies access to all of the above tools&lt;br /&gt;
deny from env=stayout&lt;br /&gt;
########## End - Common hacking tools and bandwidth higgers block&lt;br /&gt;
&lt;br /&gt;
########## Begin - Automatic compression of resources&lt;br /&gt;
# Compress text, html, javascript, css, xml, kudos to Komra.de&lt;br /&gt;
# May kill access to your site for old versions of Internet Explorer&lt;br /&gt;
# The server needs to be compiled with mod_deflate otherwise it will send HTTP 500 Error.&lt;br /&gt;
# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.&lt;br /&gt;
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript&lt;br /&gt;
########## End - Automatic compression of resources&lt;br /&gt;
&lt;br /&gt;
########## Begin - Google Apps redirection, by Komra.de&lt;br /&gt;
RewriteRule ^mail http://mail.google.com/a/example.com [R=301,L]&lt;br /&gt;
########## End - Google Apps redirection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.html~htm to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html?\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.html?$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.html~htm to / for root and /path/ for folders &lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
## Note: Change example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{THE_REQUEST} !^POST&lt;br /&gt;
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.php$ http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect index.php to / for root and /path/ for folders&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect non-www to www&lt;br /&gt;
## Note: Change www.example.com to reflect your own domain name&lt;br /&gt;
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect www to non-www&lt;br /&gt;
## WARNING: Comment out the non-www to www rule if you choose to use this&lt;br /&gt;
#RewriteCond %{HTTP_HOST} !^(example\.com)?$&lt;br /&gt;
#RewriteRule (.*) http://example.com/$1 [R=301,L]&lt;br /&gt;
########## End - Redirect non-www to www&lt;br /&gt;
&lt;br /&gt;
########## Begin - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
## Note: olddomain.com is your old domain name, you want to redirect FROM,&lt;br /&gt;
## whereas www.example.com is the new domain name you want to redirect TO.&lt;br /&gt;
## Change those names to reflect your current configuration. Remember, this&lt;br /&gt;
## small part of the file is supposed to be placed in olddomain.com!&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule ^(([^/]+/)*)index\.(php|html?) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com [NC]&lt;br /&gt;
RewriteRule (.*) http://www.example.com/$1 [R=301,L]&lt;br /&gt;
## Note: The above section is only required if you are changing your domain name.&lt;br /&gt;
########## End - Redirect (www.)olddomain.com to www.example.com&lt;br /&gt;
&lt;br /&gt;
########## Begin - Force HTTPS for certain pages&lt;br /&gt;
# Force the page foobar.html to run in HTTPS mode, no matter what Joomla! says.&lt;br /&gt;
# This line is required for this rule to work properly&lt;br /&gt;
RewriteCond %{SERVER_PORT} !^443$&lt;br /&gt;
# This is a sample redirection for foobar.html. Do note that you have to change&lt;br /&gt;
# www.example.com to reflect your own domain. Remember to escape the dots using&lt;br /&gt;
# \. in the left hand side of each rule.&lt;br /&gt;
RewriteRule ^foobar\.html$ https://www.example.com/foobar.html [R=301,L]&lt;br /&gt;
# Add more rules below this line as required&lt;br /&gt;
########## End - Force HTTPS for certain pages&lt;br /&gt;
&lt;br /&gt;
########## Begin - Rewrite rules to block out some common exploits&lt;br /&gt;
## If you experience problems on your site block out the operations listed below&lt;br /&gt;
## This attempts to block the most common type of exploit `attempts` to Joomla!&lt;br /&gt;
#&lt;br /&gt;
# If the request contains /proc/self/environ (by SigSiu.net)&lt;br /&gt;
RewriteCond %{QUERY_STRING} proc/self/environ [OR]&lt;br /&gt;
# Legacy configuration variable injection&lt;br /&gt;
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]&lt;br /&gt;
# Block out any script trying to base64_encode or base_decode stuff to send via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [OR]&lt;br /&gt;
# Block out any script that includes a &amp;lt;script&amp;gt; tag in URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} (&amp;lt;|%3C)([^s]*s)+cript.*(&amp;gt;|%3E) [NC,OR]&lt;br /&gt;
# Block out any script trying to set a PHP GLOBALS variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]&lt;br /&gt;
# Block out any script trying to modify a _REQUEST variable via URL&lt;br /&gt;
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})&lt;br /&gt;
# Return a 403 Forbidden&lt;br /&gt;
RewriteRule .* index.php [F]&lt;br /&gt;
#&lt;br /&gt;
########## End - Rewrite rules to block out some common exploits&lt;br /&gt;
&lt;br /&gt;
########## Begin - File injection protection, by SigSiu.net&lt;br /&gt;
RewriteCond %{REQUEST_METHOD} GET&lt;br /&gt;
RewriteCond %{QUERY_STRING} [a-z0-9_]=http:// [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
########## End - File injection protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection rules exceptions ####&lt;br /&gt;
##&lt;br /&gt;
## These are sample exceptions to the Advanced Server Protection 2.0&lt;br /&gt;
## rule set further down this file.&lt;br /&gt;
##&lt;br /&gt;
## Allow UddeIM CAPTCHA&lt;br /&gt;
RewriteRule ^components/com_uddeim/captcha15\.php$ - [L]&lt;br /&gt;
## Allow Phil Taylor&#039;s Turbo Gears&lt;br /&gt;
RewriteRule ^plugins/system/GoogleGears/gears-manifest\.php - [L]&lt;br /&gt;
## Allow JoomlaWorks AllVideos&lt;br /&gt;
RewriteRule ^plugins/content/jw_allvideos/includes/jw_allvideos_scripts\.php - [L]&lt;br /&gt;
## Allow Admin Tools Joomla! updater to run&lt;br /&gt;
RewriteRule ^administrator/components/com_admintools/restore\.php - [L]&lt;br /&gt;
## Allow Akeeba Backup Professional&#039;s integrated restoration script to run&lt;br /&gt;
RewriteRule ^administrator/components/com_akeeba/restore\.php - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules to single PHP files here&lt;br /&gt;
&lt;br /&gt;
## Allow Agora attachments, but not PHP files in that directory!&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !(\.php)$&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule ^components/com_agora/img/members/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more rules for allowing full access (except PHP files) on more directories here&lt;br /&gt;
&lt;br /&gt;
## Uncomment to allow full access to the cache directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^cache/ - [L]&lt;br /&gt;
## Uncomment to allow full access to the tmp directory (strongly not recommended!)&lt;br /&gt;
#RewriteRule ^tmp/ - [L]&lt;br /&gt;
&lt;br /&gt;
# Add more full access rules here&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection rules exceptions ####&lt;br /&gt;
&lt;br /&gt;
########## Begin - Advanced server protection&lt;br /&gt;
# Advanced server protection, version 2.0 - August 2010&lt;br /&gt;
# by Nicholas K. Dionysopoulos&lt;br /&gt;
&lt;br /&gt;
## Referrer filtering for common media files. Replace with your own domain.&lt;br /&gt;
## This blocks most common fingerprinting attacks ;)&lt;br /&gt;
## Note: Change www\.example\.com with your own domain name, substituting&lt;br /&gt;
## the dots with \.  i.e. use www\.example\.com for www.example.com&lt;br /&gt;
RewriteRule ^images/stories/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?) - [L]&lt;br /&gt;
RewriteCond %{HTTP_REFERER} .&lt;br /&gt;
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;
RewriteRule \.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow visual fingerprinting of Joomla! sites (module position dump)&lt;br /&gt;
## Initial idea by Brian Teeman and Ken Crowder, see:&lt;br /&gt;
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets&lt;br /&gt;
## Improved by @nikosdion to work more efficiently and handle template&lt;br /&gt;
## and tmpl query parameters&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl=component [NC]&lt;br /&gt;
RewriteRule .* - [L]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tp= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)template= [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} (^|&amp;amp;)tmpl= [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine&lt;br /&gt;
## your PHP version). See http://www.0php.com/php_easter_egg.php and&lt;br /&gt;
## http://osvdb.org/12184 for more information&lt;br /&gt;
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
## Back-end protection&lt;br /&gt;
## This also blocks fingerprinting attacks browsing for XML and INI files&lt;br /&gt;
RewriteRule ^administrator/?$ administrator/index.php [L]&lt;br /&gt;
RewriteRule ^administrator/index\.(php|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/index[23]\.php$ - [L]&lt;br /&gt;
RewriteRule ^administrator/(components|modules|templates|images|plugins)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|html?)$ - [L]&lt;br /&gt;
RewriteRule ^administrator/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Explicitly allow access only to XML-RPC&#039;s xmlrpc/index.php or plain xmlrpc/ directory&lt;br /&gt;
RewriteRule ^xmlrpc/(index\.php)?$ - [L]&lt;br /&gt;
RewriteRule ^xmlrpc/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Disallow front-end access for certain Joomla! system directories&lt;br /&gt;
RewriteRule ^includes/js/ - [L]&lt;br /&gt;
RewriteRule ^(cache|includes|language|libraries|logs|tmp)/ - [F]&lt;br /&gt;
&lt;br /&gt;
## Allow limited access for certain Joomla! system directories with client-accessible content&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^.]+)\.(jpe[g2]?|jpg|png|gif|bmp|css|js|swf|ico|html?)$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/([^/]+/)*(index\.php)? - [L]&lt;br /&gt;
RewriteRule ^templates/([^.]+)\.php$ - [L]&lt;br /&gt;
RewriteRule ^(components|modules|plugins|templates)/.+ - [F]&lt;br /&gt;
## Changed above patterns to allow both /folder/ and /folder/index.php requests for JA Purity II&lt;br /&gt;
&lt;br /&gt;
## Disallow access to htaccess.txt, configuration.php, configuration.php-dist and php.ini&lt;br /&gt;
RewriteRule ^(htaccess\.txt|configuration\.php(-dist)?|php\.ini)$ - [F]&lt;br /&gt;
&lt;br /&gt;
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) @&lt;br /&gt;
## http://www.sigsiu.net/presentations/fortifying_your_joomla_website.html&lt;br /&gt;
## May cause problems on legitimate requests&lt;br /&gt;
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^s]*s)+elect[^\(]*\( [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
&lt;br /&gt;
########## End - Advanced server protection&lt;br /&gt;
&lt;br /&gt;
########## Begin - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
## I removed some common words, tweak to your liking&lt;br /&gt;
## This code uses PCRE and works only with Apache 2.x. &lt;br /&gt;
## This code will NOT work with Apache 1.x servers.&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]&lt;br /&gt;
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]&lt;br /&gt;
RewriteRule .* - [F]&lt;br /&gt;
## Note: The final RewriteCond must NOT use the [OR] flag.&lt;br /&gt;
########## End - Basic antispam Filter, by SigSiu.net&lt;br /&gt;
&lt;br /&gt;
########## Begin - Joomla! core SEF Section&lt;br /&gt;
#&lt;br /&gt;
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/index\.php&lt;br /&gt;
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json))$ [NC]&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-f&lt;br /&gt;
RewriteCond %{REQUEST_FILENAME} !-d&lt;br /&gt;
RewriteRule .* index.php [L]&lt;br /&gt;
#&lt;br /&gt;
########## End - Joomla! core SEF Section&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
[http://perishablepress.com/press/tag/htaccess/ .htaccess tag archive @ perishablepress.com]&lt;br /&gt;
&lt;br /&gt;
[http://snipt.net/nikosdion/the-master-htaccess. proposed &amp;quot;master htaccess&amp;quot; (updated by Nicholas on November 18th 2010) DO read the intro by Nichols!]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>G1smd</name></author>
	</entry>
</feed>