Animation


DIVs vs. Tables

Float Layouts

Inline Blocks

Block Layouts


Centering

Split Bkgrd

Graphic Borders

Horizontal Lists

CSS Colors


.htaccess

Block IPs

Down for Maintenance

Page Redirect

Custom Error Pages


Escaping query strings

PNG transparency

Google App testing

Flash Optimizing

Avoid AS Statics

SEO Optimization



.htaccess file

.htaccess File Tutorial

Apache .htaccess files function only on Apache servers. Most likely your web site is on an Apache server however if your web site is on a Microsoft IIS server, then use must use configuration methods not covered here.

The .htaccess file configures your web site on a directory by directory bases. Each .htaccess sets up your web pages in the same directory that it resides and in all sub-directories. .htaccess files in sub-directories override settings made in .htaccess files that are in parent directories. So, in short, they cascade similar to style sheets.

Backup your original .htaccess file

It is vital that you back up the original .htaccess file that is on your site. Then edit the original file to change or add what you need. Do not change or remove anything you don't understand. This can disable your web site if a mistake is made. But fortunately you'll have a backup of the original should you need to recover.

To Use .htaccess

  1. Open your FTP program to your web server
  2. Navigate into your web site's root directory in FTP
  3. If an .htaccess is present, download it.
  4. Make a backup copy of the .htaccess file on your computer
  5. If your site didn't have an .htaccess file, make a new text file
  6. When you make changes to your .htaccess, upload the file to test

Always have your backup copy of the original .htaccess file ready to re-upload if you have any problem

Below are 4 useful configurations for which you can use .htaccess but there are also many more not covered here.

.htaccess Configurations

See the links above to learn what each of the lines below do (custom error pages, redirection, block abusive visitors)

Example .htaccess file

ErrorDocument 404 /page_not_found.html
Redirect 301 /scl http://StructuredCanvasLanguage.com/
Order Allow,Deny
Allow from All
Deny from 212.64.52.121

Did you find this article userful for your website?
If so, why not provide a link to it? Just copy the following to your web page:

<a href='http://upwithabang.com/articles/htaccess-tutorial.html'>htaccess tutorials</a>