How can I use htaccess to password protect a directory?

Create a file named .htaccess in your web directory that contains the following: AuthUserFile /home/yourlogin/yourdirectory/.htpasswd AuthName Secure AuthType basic require valid-user Then in your home directory, type htpasswd -c /home/yourlogin/yourdirectory/.htpasswd pumpkin. You will be prompted to enter a password and verify it. This will enable you to secure the directory so that only user pumpkin can enter this directory. To add additional id/password pairs to the file, leave off the -c, which means ‘create a new file’. For example, htpasswd .htpasswd linus. You may well want any of the user/password combinations you created in your .htpasswd file to allow access. Note that you want to store the .htpasswd file in your home directory so it is hidden from others. The one drawback to putting your .htpasswd file in your home directory is that you will have to slightly lower the security of your home directory. Go to /home (cd /home/yourlogin) and type chmod +x yourlogin. The WWW server needs execute permission on to read the .htpasswd...

How do I prevent spam from email harvestering?

RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^Bullseye.* [OR] RewriteCond %{HTTP_USER_AGENT} ^fastlwspider* [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailCollector [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^GetWebPage.* [OR] RewriteCond %{HTTP_USER_AGENT} ^lwp-tribial.* [OR] RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*NEWT [OR] RewriteCond %{HTTP_USER_AGENT} ^Crescent [OR] RewriteCond %{HTTP_USER_AGENT} ^CherryPicker [OR] RewriteCond %{HTTP_USER_AGENT} ^[Ww]eb[Bb]andit [OR] RewriteCond %{HTTP_USER_AGENT} ^WebEMailExtrac.* [OR] RewriteCond %{HTTP_USER_AGENT} ^NICErsPRO [OR] RewriteCond %{HTTP_USER_AGENT} ^SurfWalker [OR] RewriteCond %{HTTP_USER_AGENT} ^Telesoft [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR] RewriteCond %{HTTP_USER_AGENT} ^Microsoft.URL [OR] RewriteCond %{HTTP_USER_AGENT} ^Mozilla/3.Mozilla/2.01 [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailCollector RewriteRule ^.*$ –...

How do I stop off-line browsers/ robot surfers?

RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^Mozilla RewriteRule /* – [L] RewriteCond %{HTTP_USER_AGENT} ^Teleport [OR] RewriteCond %{HTTP_USER_AGENT} ^Internet Ninja [OR] RewriteCond %{HTTP_USER_AGENT} ^Aculinx [OR] RewriteCond %{HTTP_USER_AGENT} ^Ants [OR] RewriteCond %{HTTP_USER_AGENT} ^attach [OR] RewriteCond %{HTTP_USER_AGENT} ^Backstreet [OR] RewriteCond %{HTTP_USER_AGENT} ^BackWeb [OR] RewriteCond %{HTTP_USER_AGENT} ^Bandit [OR] RewriteCond %{HTTP_USER_AGENT} ^Buddy [OR] RewriteCond %{HTTP_USER_AGENT} ^Burner [OR] RewriteCond %{HTTP_USER_AGENT} ^Caitoo [OR] RewriteCond %{HTTP_USER_AGENT} ^Collector [OR] RewriteCond %{HTTP_USER_AGENT} ^Commander [OR] RewriteCond %{HTTP_USER_AGENT} ^Copier [OR] RewriteCond %{HTTP_USER_AGENT} ^Crawler [OR] RewriteCond %{HTTP_USER_AGENT} ^Curl [OR] RewriteCond %{HTTP_USER_AGENT} ^DA ..0 [OR] RewriteCond %{HTTP_USER_AGENT} ^Devil [OR] RewriteCond %{HTTP_USER_AGENT} ^DISCo Pump [OR] RewriteCond %{HTTP_USER_AGENT} ^Down2Web [OR] RewriteCond %{HTTP_USER_AGENT} ^Downloader [OR] RewriteCond %{HTTP_USER_AGENT} ^DownloadIt [OR] RewriteCond %{HTTP_USER_AGENT} ^Drip [OR] RewriteCond %{HTTP_USER_AGENT} ^Eater [OR] RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] RewriteCond %{HTTP_USER_AGENT} ^Eclipt [OR] RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^Enterprise [OR] RewriteCond %{HTTP_USER_AGENT} ^Express [OR] RewriteCond %{HTTP_USER_AGENT} ^Extractor [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] RewriteCond %{HTTP_USER_AGENT} ^FairAd Client [OR] RewriteCond %{HTTP_USER_AGENT} ^FileHound [OR] RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] RewriteCond %{HTTP_USER_AGENT} ^FlashSite [OR] RewriteCond %{HTTP_USER_AGENT} ^FlipBrowser [OR] RewriteCond %{HTTP_USER_AGENT} ^GetBot [OR] RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] RewriteCond %{HTTP_USER_AGENT} ^GetSmart [OR] RewriteCond %{HTTP_USER_AGENT} ^Gets [OR] RewriteCond %{HTTP_USER_AGENT} ^GetWeb [OR] RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] RewriteCond %{HTTP_USER_AGENT} ^gotit [OR] RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] RewriteCond %{HTTP_USER_AGENT} ^Grabber [OR] RewriteCond %{HTTP_USER_AGENT} ^Grab [OR] RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] RewriteCond %{HTTP_USER_AGENT} ^Greed [OR] RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] RewriteCond %{HTTP_USER_AGENT} ^Hoover [OR] RewriteCond %{HTTP_USER_AGENT} ^HtGet [OR] RewriteCond %{HTTP_USER_AGENT} ^HTTrack [OR] RewriteCond %{HTTP_USER_AGENT} ^IBrowse [OR] RewriteCond %{HTTP_USER_AGENT} ^iFox98 [OR] RewriteCond %{HTTP_USER_AGENT} ^IGJpg$ [OR] RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] RewriteCond %{HTTP_USER_AGENT} ^InternetLinkAgent [OR] RewriteCond %{HTTP_USER_AGENT} ^IPhoto [OR] RewriteCond %{HTTP_USER_AGENT} ^iwantmy [OR] RewriteCond %{HTTP_USER_AGENT} ^iwantmyxxx.com [OR] RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] RewriteCond %{HTTP_USER_AGENT} ^JOC [OR] RewriteCond %{HTTP_USER_AGENT} ^JustView [OR]...

How can I setup dynamic/custom error pages?

If you have defined your own custom Error Pages using the “Define Error Pages” tool within the Control Panel, you may have noticed that you can only define the contents of a non-dynamic file. If you want a tighter integration to your dynamic design, then you can do this by modifying “.htaccess”. View the examples below and modify any one of them to satisfy your needs. Examples: ErrorDocument 401 http://www.foo.com/files/401.php ErrorDocument 402 /files/error.php ErrorDocument 403 http://www.foo.com/cgi-bin/script.cgi Redirecting your Domain or any Subdirectory By adding a “Redirect” statement, you can redirect any subdomain or your whole domain to any other file or domain in the Internet. Each “Redirect” statement contains the “Redirect” command, the location to be redirected and the target of the redirection. You may redirect your domain to some other domain you own or you may redirect requests for e.g. “/color” to a subdirectory called “/colour”. Enter a line like below to redirect your Domain (it will not redirect if there is a request for a specific sub-page): Redirect /index.html http://www.foo.com Enter a line like below to redirect a Subdirectory: Redirect /redirectthis/index.html http://foo.com/target.html Hint: In both cases the target must be a full URL starting with http:// even if the target of the redirection is located in your domain. Hint: Always include “index.html” after a directory...