Question regarding .htaccess

Discussion in 'General Webmaster Discussion' started by Orion, Nov 4, 2009.

Remove these ads by signing in
Remove these ads by signing in
Thread Status:
Not open for further replies.
  1. Orion New Member

    Member Since:
    Sep 29, 2009
    Message Count:
    969
    Likes Received:
    25
    Location:
    http://admin-spot.com
    I'm starting a new site using Joomla, and would like to know how to set up my .htaccess correctly. Please enlighten me as to what I need to do to go about doing this. :)
  2. Adam H Administrator

    Member Since:
    Jan 7, 2008
    Message Count:
    2,807
    Likes Received:
    162
    Occupation:
    Web Developer
    Location:
    Norfolk Uk
    Haha ok i suppose i asked for that :p, Ok this is a nice little .htaccess that i have made to protect Joomla sites and i use it on all of my Joomla sites.

    First you need to enable SEF URL's and apache mod-rewrite in the global config in Joomla.

    Now you will need to make the .htaccess file. Delete the htaccess.txt from your hosting joomla root and use the one below :

    Dont forget to change the bits that i have highlighted in bold.

    I will explain each part of the this file below the main file below.

    Code (text):
    Options +FollowSymLinks
    RewriteEngine On

    DirectoryIndex index.php
     
    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ [B][COLOR="Red"]http://www.YOURDOMAIN.com[/COLOR][/B]/ [R=301,L]
     
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    RewriteCond %{HTTP_HOST} ^[B][COLOR="Red"]YOURDOMAIN.com[/COLOR][/B] [NC]
    RewriteRule ^(.*)$ http://[B][COLOR="Red"]www.YOURDOMAIN.com[/COLOR][/B]/$1 [L,R=301]


    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    RewriteRule ^(.*)$ index.php [F,L]

    # RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index.php
    RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #                              
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits

    <Limit GET HEAD POST>
    order allow,deny
    deny from 58.186.0.0/15
    deny from 116.68.128.0/21
    deny from 116.96.0.0/12
    deny from 116.118.0.0/17
    deny from 116.193.64.0/20
    deny from 117.0.0.0/13
    deny from 122.201.8.0/21
    deny from 123.16.0.0/12
    deny from 125.212.128.0/17
    deny from 125.214.0.0/18
    deny from 125.234.0.0/15
    deny from 202.6.2.0/24
    deny from 202.6.96.0/23
    deny from 202.47.142.0/24
    deny from 202.60.104.0/21
    deny from 202.78.224.0/21
    deny from 202.79.232.0/21
    deny from 202.92.4.0/22
    deny from 202.134.16.0/21
    deny from 202.151.160.0/20
    deny from 202.172.4.0/23
    deny from 203.77.178.0/24
    deny from 203.99.248.0/22
    deny from 203.113.128.0/19
    deny from 203.113.160.0/19
    deny from 203.119.8.0/22
    deny from 203.119.36.0/22
    deny from 203.119.44.0/22
    deny from 203.128.240.0/21
    deny from 203.160.0.0/23
    deny from 203.160.96.0/21
    deny from 203.161.0.0/22
    deny from 203.162.0.0/21
    deny from 203.162.8.0/21
    deny from 203.162.16.0/20
    deny from 203.162.32.0/19
    deny from 203.162.64.0/18
    deny from 203.162.128.0/20
    deny from 203.162.144.0/20
    deny from 203.162.160.0/19
    deny from 203.162.192.0/18
    deny from 203.171.16.0/20
    deny from 203.176.160.0/21
    deny from 203.190.160.0/20
    deny from 203.191.8.0/21
    deny from 203.191.48.0/21
    deny from 203.210.128.0/18
    deny from 203.210.192.0/18
    deny from 210.86.224.0/20
    deny from 210.245.0.0/19
    deny from 210.245.32.0/19
    deny from 210.245.64.0/18
    deny from 218.100.10.0/24
    deny from 218.100.14.0/24
    deny from 220.231.64.0/18
    deny from 221.121.0.0/18
    deny from 221.132.0.0/18
    deny from 221.133.0.0/19
    deny from 222.252.0.0/14
    allow from all
    </LIMIT>
                       

    SetEnvIfNoCase User-Agent "^Black Hole" bad_bot
    SetEnvIfNoCase User-Agent "^Titan" bad_bot
    SetEnvIfNoCase User-Agent "^WebStripper" bad_bot
    SetEnvIfNoCase User-Agent "^NetMechanic" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPicker" bad_bot
    SetEnvIfNoCase User-Agent "^EmailCollector" bad_bot
    SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot
    SetEnvIfNoCase User-Agent "^WebBandit" bad_bot
    SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot
    SetEnvIfNoCase User-Agent "^ExtractorPro" bad_bot
    SetEnvIfNoCase User-Agent "^CopyRightCheck" bad_bot
    SetEnvIfNoCase User-Agent "^Crescent" bad_bot
    SetEnvIfNoCase User-Agent "^Wget" bad_bot
    SetEnvIfNoCase User-Agent "^SiteSnagger" bad_bot
    SetEnvIfNoCase User-Agent "^ProWebWalker" bad_bot
    SetEnvIfNoCase User-Agent "^CheeseBot" bad_bot
    SetEnvIfNoCase User-Agent "^Teleport" bad_bot
    SetEnvIfNoCase User-Agent "^TeleportPro" bad_bot
    SetEnvIfNoCase User-Agent "^MIIxpc" bad_bot
    SetEnvIfNoCase User-Agent "^Telesoft" bad_bot
    SetEnvIfNoCase User-Agent "^Website Quester" bad_bot
    SetEnvIfNoCase User-Agent "^WebZip" bad_bot
    SetEnvIfNoCase User-Agent "^moget/2.1" bad_bot
    SetEnvIfNoCase User-Agent "^WebZip/4.0" bad_bot
    SetEnvIfNoCase User-Agent "^WebSauger" bad_bot
    SetEnvIfNoCase User-Agent "^WebCopier" bad_bot
    SetEnvIfNoCase User-Agent "^NetAnts" bad_bot
    SetEnvIfNoCase User-Agent "^Mister PiX" bad_bot
    SetEnvIfNoCase User-Agent "^WebAuto" bad_bot
    SetEnvIfNoCase User-Agent "^TheNomad" bad_bot
    SetEnvIfNoCase User-Agent "^WWW-Collector-E" bad_bot
    SetEnvIfNoCase User-Agent "^RMA" bad_bot
    SetEnvIfNoCase User-Agent "^libWeb/clsHTTP" bad_bot
    SetEnvIfNoCase User-Agent "^asterias" bad_bot
    SetEnvIfNoCase User-Agent "^httplib" bad_bot
    SetEnvIfNoCase User-Agent "^turingos" bad_bot
    SetEnvIfNoCase User-Agent "^spanner" bad_bot
    SetEnvIfNoCase User-Agent "^InfoNaviRobot" bad_bot
    SetEnvIfNoCase User-Agent "^Harvest/1.5" bad_bot
    SetEnvIfNoCase User-Agent "^Bullseye/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^Mozilla/4.0 (compatible; BullsEye; Windows 95)" bad_bot
    SetEnvIfNoCase User-Agent "^Crescent Internet ToolPak HTTP OLE Control v.1.0" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPickerSE/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPicker /1.0" bad_bot
    SetEnvIfNoCase User-Agent "^WebBandit/3.50" bad_bot
    SetEnvIfNoCase User-Agent "^NICErsPRO" bad_bot
    SetEnvIfNoCase User-Agent "^Microsoft URL Control - 5.01.4511" bad_bot
    SetEnvIfNoCase User-Agent "^DittoSpyder" bad_bot
    SetEnvIfNoCase User-Agent "^Foobot" bad_bot
    SetEnvIfNoCase User-Agent "^WebmasterWorldForumBot" bad_bot
    SetEnvIfNoCase User-Agent "^SpankBot" bad_bot
    SetEnvIfNoCase User-Agent "^BotALot" bad_bot
    SetEnvIfNoCase User-Agent "^lwp-trivial/1.34" bad_bot
    SetEnvIfNoCase User-Agent "^lwp-trivial" bad_bot
    SetEnvIfNoCase User-Agent "^Wget/1.6" bad_bot
    SetEnvIfNoCase User-Agent "^BunnySlippers" bad_bot
    SetEnvIfNoCase User-Agent "^Microsoft URL Control - 6.00.8169" bad_bot
    SetEnvIfNoCase User-Agent "^URLy Warning" bad_bot
    SetEnvIfNoCase User-Agent "^Wget/1.5.3" bad_bot
    SetEnvIfNoCase User-Agent "^LinkWalker" bad_bot
    SetEnvIfNoCase User-Agent "^cosmos" bad_bot
    SetEnvIfNoCase User-Agent "^moget" bad_bot
    SetEnvIfNoCase User-Agent "^hloader" bad_bot
    SetEnvIfNoCase User-Agent "^humanlinks" bad_bot
    SetEnvIfNoCase User-Agent "^LinkextractorPro" bad_bot
    SetEnvIfNoCase User-Agent "^Offline Explorer" bad_bot
    SetEnvIfNoCase User-Agent "^Mata Hari" bad_bot
    SetEnvIfNoCase User-Agent "^LexiBot" bad_bot
    SetEnvIfNoCase User-Agent "^Web Image Collector" bad_bot
    SetEnvIfNoCase User-Agent "^The Intraformant" bad_bot
    SetEnvIfNoCase User-Agent "^True_Robot/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^True_Robot" bad_bot
    SetEnvIfNoCase User-Agent "^BlowFish/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^JennyBot" bad_bot
    SetEnvIfNoCase User-Agent "^MIIxpc/4.2" bad_bot
    SetEnvIfNoCase User-Agent "^BuiltBotTough" bad_bot
    SetEnvIfNoCase User-Agent "^ProPowerBot/2.14" bad_bot
    SetEnvIfNoCase User-Agent "^BackDoorBot/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^toCrawl/UrlDispatcher" bad_bot
    SetEnvIfNoCase User-Agent "^WebEnhancer" bad_bot
    SetEnvIfNoCase User-Agent "^TightTwatBot" bad_bot
    SetEnvIfNoCase User-Agent "^suzuran" bad_bot
    SetEnvIfNoCase User-Agent "^VCI WebViewer VCI WebViewer Win32" bad_bot
    SetEnvIfNoCase User-Agent "^VCI" bad_bot
    SetEnvIfNoCase User-Agent "^Szukacz/1.4" bad_bot
    SetEnvIfNoCase User-Agent "^QueryN Metasearch" bad_bot
    SetEnvIfNoCase User-Agent "^Openfind data gathere" bad_bot
    SetEnvIfNoCase User-Agent "^Openfind" bad_bot
    SetEnvIfNoCase User-Agent "^Xenu's Link Sleuth 1.1c" bad_bot
    SetEnvIfNoCase User-Agent "^Xenu's" bad_bot
    SetEnvIfNoCase User-Agent "^Zeus" bad_bot
    SetEnvIfNoCase User-Agent "^RepoMonkey Bait & Tackle/v1.01" bad_bot
    SetEnvIfNoCase User-Agent "^RepoMonkey" bad_bot
    SetEnvIfNoCase User-Agent "^Zeus 32297 Webster Pro V2.9 Win32" bad_bot
    SetEnvIfNoCase User-Agent "^Webster Pro" bad_bot
    SetEnvIfNoCase User-Agent "^EroCrawler" bad_bot
    SetEnvIfNoCase User-Agent "^LinkScan/8.1a Unix" bad_bot
    SetEnvIfNoCase User-Agent "^Keyword Density/0.9" bad_bot
    SetEnvIfNoCase User-Agent "^Kenjin Spider" bad_bot
    SetEnvIfNoCase User-Agent "^Cegbfeieh" bad_bot

    <Limit GET POST>
    order allow,deny
    allow from all
    Deny from env=bad_bot
    </Limit>

    Ok so ill tell you what each part does.

    Code (text):
    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.YOURDOMAIN.com/ [R=301,L]
     
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    RewriteCond %{HTTP_HOST} ^YOURDOMAIN.com [NC]
    RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [L,R=301]
    This Part redirects the non www to the www. which helps with SEO so that there isnt any chance of duplicate content .

    Code (text):
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    RewriteRule ^(.*)$ index.php [F,L]

    # RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index.php
    RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
    RewriteRule (.*) index.php
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #                              
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits
     
    The above blocks some of the most common Joomla exploits that are known to most people.

    Code (text):
    <Limit GET HEAD POST>
    order allow,deny
    deny from 58.186.0.0/15
    deny from 116.68.128.0/21
    deny from 116.96.0.0/12
    deny from 116.118.0.0/17
    deny from 116.193.64.0/20
    deny from 117.0.0.0/13
    deny from 122.201.8.0/21
    deny from 123.16.0.0/12
    deny from 125.212.128.0/17
    deny from 125.214.0.0/18
    deny from 125.234.0.0/15
    deny from 202.6.2.0/24
    deny from 202.6.96.0/23
    deny from 202.47.142.0/24
    deny from 202.60.104.0/21
    deny from 202.78.224.0/21
    deny from 202.79.232.0/21
    deny from 202.92.4.0/22
    deny from 202.134.16.0/21
    deny from 202.151.160.0/20
    deny from 202.172.4.0/23
    deny from 203.77.178.0/24
    deny from 203.99.248.0/22
    deny from 203.113.128.0/19
    deny from 203.113.160.0/19
    deny from 203.119.8.0/22
    deny from 203.119.36.0/22
    deny from 203.119.44.0/22
    deny from 203.128.240.0/21
    deny from 203.160.0.0/23
    deny from 203.160.96.0/21
    deny from 203.161.0.0/22
    deny from 203.162.0.0/21
    deny from 203.162.8.0/21
    deny from 203.162.16.0/20
    deny from 203.162.32.0/19
    deny from 203.162.64.0/18
    deny from 203.162.128.0/20
    deny from 203.162.144.0/20
    deny from 203.162.160.0/19
    deny from 203.162.192.0/18
    deny from 203.171.16.0/20
    deny from 203.176.160.0/21
    deny from 203.190.160.0/20
    deny from 203.191.8.0/21
    deny from 203.191.48.0/21
    deny from 203.210.128.0/18
    deny from 203.210.192.0/18
    deny from 210.86.224.0/20
    deny from 210.245.0.0/19
    deny from 210.245.32.0/19
    deny from 210.245.64.0/18
    deny from 218.100.10.0/24
    deny from 218.100.14.0/24
    deny from 220.231.64.0/18
    deny from 221.121.0.0/18
    deny from 221.132.0.0/18
    deny from 221.133.0.0/19
    deny from 222.252.0.0/14
    allow from all
    </LIMIT>
                       
    After my site got hacked a number of times i decided to block the entire country of Vietnam which is where most of the hacking attempts came from , its up to you whether you want to do the same but i would recommend it unless you really think that you will get good visitors from Vietnam.

    Code (text):
    SetEnvIfNoCase User-Agent "^Black Hole" bad_bot
    SetEnvIfNoCase User-Agent "^Titan" bad_bot
    SetEnvIfNoCase User-Agent "^WebStripper" bad_bot
    SetEnvIfNoCase User-Agent "^NetMechanic" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPicker" bad_bot
    SetEnvIfNoCase User-Agent "^EmailCollector" bad_bot
    SetEnvIfNoCase User-Agent "^EmailSiphon" bad_bot
    SetEnvIfNoCase User-Agent "^WebBandit" bad_bot
    SetEnvIfNoCase User-Agent "^EmailWolf" bad_bot
    SetEnvIfNoCase User-Agent "^ExtractorPro" bad_bot
    SetEnvIfNoCase User-Agent "^CopyRightCheck" bad_bot
    SetEnvIfNoCase User-Agent "^Crescent" bad_bot
    SetEnvIfNoCase User-Agent "^Wget" bad_bot
    SetEnvIfNoCase User-Agent "^SiteSnagger" bad_bot
    SetEnvIfNoCase User-Agent "^ProWebWalker" bad_bot
    SetEnvIfNoCase User-Agent "^CheeseBot" bad_bot
    SetEnvIfNoCase User-Agent "^Teleport" bad_bot
    SetEnvIfNoCase User-Agent "^TeleportPro" bad_bot
    SetEnvIfNoCase User-Agent "^MIIxpc" bad_bot
    SetEnvIfNoCase User-Agent "^Telesoft" bad_bot
    SetEnvIfNoCase User-Agent "^Website Quester" bad_bot
    SetEnvIfNoCase User-Agent "^WebZip" bad_bot
    SetEnvIfNoCase User-Agent "^moget/2.1" bad_bot
    SetEnvIfNoCase User-Agent "^WebZip/4.0" bad_bot
    SetEnvIfNoCase User-Agent "^WebSauger" bad_bot
    SetEnvIfNoCase User-Agent "^WebCopier" bad_bot
    SetEnvIfNoCase User-Agent "^NetAnts" bad_bot
    SetEnvIfNoCase User-Agent "^Mister PiX" bad_bot
    SetEnvIfNoCase User-Agent "^WebAuto" bad_bot
    SetEnvIfNoCase User-Agent "^TheNomad" bad_bot
    SetEnvIfNoCase User-Agent "^WWW-Collector-E" bad_bot
    SetEnvIfNoCase User-Agent "^RMA" bad_bot
    SetEnvIfNoCase User-Agent "^libWeb/clsHTTP" bad_bot
    SetEnvIfNoCase User-Agent "^asterias" bad_bot
    SetEnvIfNoCase User-Agent "^httplib" bad_bot
    SetEnvIfNoCase User-Agent "^turingos" bad_bot
    SetEnvIfNoCase User-Agent "^spanner" bad_bot
    SetEnvIfNoCase User-Agent "^InfoNaviRobot" bad_bot
    SetEnvIfNoCase User-Agent "^Harvest/1.5" bad_bot
    SetEnvIfNoCase User-Agent "^Bullseye/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^Mozilla/4.0 (compatible; BullsEye; Windows 95)" bad_bot
    SetEnvIfNoCase User-Agent "^Crescent Internet ToolPak HTTP OLE Control v.1.0" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPickerSE/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^CherryPicker /1.0" bad_bot
    SetEnvIfNoCase User-Agent "^WebBandit/3.50" bad_bot
    SetEnvIfNoCase User-Agent "^NICErsPRO" bad_bot
    SetEnvIfNoCase User-Agent "^Microsoft URL Control - 5.01.4511" bad_bot
    SetEnvIfNoCase User-Agent "^DittoSpyder" bad_bot
    SetEnvIfNoCase User-Agent "^Foobot" bad_bot
    SetEnvIfNoCase User-Agent "^WebmasterWorldForumBot" bad_bot
    SetEnvIfNoCase User-Agent "^SpankBot" bad_bot
    SetEnvIfNoCase User-Agent "^BotALot" bad_bot
    SetEnvIfNoCase User-Agent "^lwp-trivial/1.34" bad_bot
    SetEnvIfNoCase User-Agent "^lwp-trivial" bad_bot
    SetEnvIfNoCase User-Agent "^Wget/1.6" bad_bot
    SetEnvIfNoCase User-Agent "^BunnySlippers" bad_bot
    SetEnvIfNoCase User-Agent "^Microsoft URL Control - 6.00.8169" bad_bot
    SetEnvIfNoCase User-Agent "^URLy Warning" bad_bot
    SetEnvIfNoCase User-Agent "^Wget/1.5.3" bad_bot
    SetEnvIfNoCase User-Agent "^LinkWalker" bad_bot
    SetEnvIfNoCase User-Agent "^cosmos" bad_bot
    SetEnvIfNoCase User-Agent "^moget" bad_bot
    SetEnvIfNoCase User-Agent "^hloader" bad_bot
    SetEnvIfNoCase User-Agent "^humanlinks" bad_bot
    SetEnvIfNoCase User-Agent "^LinkextractorPro" bad_bot
    SetEnvIfNoCase User-Agent "^Offline Explorer" bad_bot
    SetEnvIfNoCase User-Agent "^Mata Hari" bad_bot
    SetEnvIfNoCase User-Agent "^LexiBot" bad_bot
    SetEnvIfNoCase User-Agent "^Web Image Collector" bad_bot
    SetEnvIfNoCase User-Agent "^The Intraformant" bad_bot
    SetEnvIfNoCase User-Agent "^True_Robot/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^True_Robot" bad_bot
    SetEnvIfNoCase User-Agent "^BlowFish/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^JennyBot" bad_bot
    SetEnvIfNoCase User-Agent "^MIIxpc/4.2" bad_bot
    SetEnvIfNoCase User-Agent "^BuiltBotTough" bad_bot
    SetEnvIfNoCase User-Agent "^ProPowerBot/2.14" bad_bot
    SetEnvIfNoCase User-Agent "^BackDoorBot/1.0" bad_bot
    SetEnvIfNoCase User-Agent "^toCrawl/UrlDispatcher" bad_bot
    SetEnvIfNoCase User-Agent "^WebEnhancer" bad_bot
    SetEnvIfNoCase User-Agent "^TightTwatBot" bad_bot
    SetEnvIfNoCase User-Agent "^suzuran" bad_bot
    SetEnvIfNoCase User-Agent "^VCI WebViewer VCI WebViewer Win32" bad_bot
    SetEnvIfNoCase User-Agent "^VCI" bad_bot
    SetEnvIfNoCase User-Agent "^Szukacz/1.4" bad_bot
    SetEnvIfNoCase User-Agent "^QueryN Metasearch" bad_bot
    SetEnvIfNoCase User-Agent "^Openfind data gathere" bad_bot
    SetEnvIfNoCase User-Agent "^Openfind" bad_bot
    SetEnvIfNoCase User-Agent "^Xenu's Link Sleuth 1.1c" bad_bot
    SetEnvIfNoCase User-Agent "^Xenu's" bad_bot
    SetEnvIfNoCase User-Agent "^Zeus" bad_bot
    SetEnvIfNoCase User-Agent "^RepoMonkey Bait & Tackle/v1.01" bad_bot
    SetEnvIfNoCase User-Agent "^RepoMonkey" bad_bot
    SetEnvIfNoCase User-Agent "^Zeus 32297 Webster Pro V2.9 Win32" bad_bot
    SetEnvIfNoCase User-Agent "^Webster Pro" bad_bot
    SetEnvIfNoCase User-Agent "^EroCrawler" bad_bot
    SetEnvIfNoCase User-Agent "^LinkScan/8.1a Unix" bad_bot
    SetEnvIfNoCase User-Agent "^Keyword Density/0.9" bad_bot
    SetEnvIfNoCase User-Agent "^Kenjin Spider" bad_bot
    SetEnvIfNoCase User-Agent "^Cegbfeieh" bad_bot

    <Limit GET POST>
    order allow,deny
    allow from all
    Deny from env=bad_bot
    </Limit>
    This will block alot of bad bots which just use your bandwidth , steal your content and generally have no use what so ever, it will also help with site speed since your site wont be clogged up with spiders everywhere

    Hope that helps some of you
    1 people like this.
  3. Orion New Member

    Member Since:
    Sep 29, 2009
    Message Count:
    969
    Likes Received:
    25
    Location:
    http://admin-spot.com
  4. SeoKungFu Active Member

    Member Since:
    Jul 10, 2009
    Message Count:
    604
    Likes Received:
    77
    Occupation:
    SEO Ninja
    But now you can say what exactly do you need to do with yours ?
  5. proweb New Member

    Member Since:
    Jul 22, 2009
    Message Count:
    1,308
    Likes Received:
    44
    Occupation:
    Joomla Designer
    Location:
    Joomla Expert
    The part with the IP's block and the spiders block are awesome, I really needed this!

    I'm using this code to redirect the WWW to NON WWW

    Code (text):

    RewriteCond %{HTTP_HOST} ^www.[B][COLOR=Red]yourwebsite.com[/COLOR][/B] [NC]
    RewriteRule ^(.*)$ http://[COLOR=Red][B]yourwebsite.com[/B][/COLOR]/$1 [L,R=301]
     
    I hope this also will be helpful!
  6. proweb New Member

    Member Since:
    Jul 22, 2009
    Message Count:
    1,308
    Likes Received:
    44
    Occupation:
    Joomla Designer
    Location:
    Joomla Expert
    @River

    I saw that you also redirected the index.php to the homepage, I made the same thing, maybe not with this code, but, after I redirect the index I can't access the administrator panel anymore.

    You know that the administrator use another index.php, this will be also redirected to the base url? Or only the www.sitename.com/index.php will be redirected with this code?
  7. sazymi New Member

    Member Since:
    May 13, 2009
    Message Count:
    1,384
    Likes Received:
    57
    Occupation:
    SEO, SMO, Blogger
    Location:
    Los Angeles, CA

    That was really great Proweb, I would love to do that and it was awesome. Redirecting www to non www is a good way too. But I'm afraid it will be counted as a black hat thing. Its more like stealing a traffic, Am I right?
  8. proweb New Member

    Member Since:
    Jul 22, 2009
    Message Count:
    1,308
    Likes Received:
    44
    Occupation:
    Joomla Designer
    Location:
    Joomla Expert
    This is not a black hat thing, is the same, like you redirect the non www to www.

    What can I do, if I made all my backlinks without www :angry:?
    I'm using the 301 redirect, everyone use this...
  9. Adam H Administrator

    Member Since:
    Jan 7, 2008
    Message Count:
    2,807
    Likes Received:
    162
    Occupation:
    Web Developer
    Location:
    Norfolk Uk

    Its definatly not Black hat , in fact its an important factor of SEO , you just have to decide whether you want to redirect the non www to www or the other way around.

    That is something that is a problem which i have yet to solve, i usually store 2 versions of the htaccess one with a different name , so when i want to access the admin panel i quickly change the htaccess so i can access it.

    Im sure there is a rule to avoid this problem, however for some reason this only happens on some sites, On 2 of my sites i can still access the admin even with this code in it
Thread Status:
Not open for further replies.

Share This Page