DIVs vs. Tables
Down for Maintenance
Custom Error Pages
Escaping query strings
Google App testing
Avoid AS Statics
.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
- Open your FTP program to your web server
- Navigate into your web site's root directory in FTP
- If an .htaccess is present, download it.
- Make a backup copy of the .htaccess file on your computer
- If your site didn't have an .htaccess file, make a new text file
- 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.
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/
Allow from All
Deny from 22.214.171.124
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: