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





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.

htaccess-redirect

A redirect instructs the web server to show a different page than the page requested. Redirects have a status number that tell the visitor's browser the reason for the redirect. 301 means that a page has been permanently moved.

After the status number comes the requested page. In the example above, anything file in the /scl folder would be redirected to the site indicated. However there is an issue with how this works that causes confusion:

When Apache sees the requested URL as /scl, it interprets that to be just the beginning of any URL being requested so it only replaces that beginning with the new URL. This means that:

/scl/learn.html becomes http://StructuredCanvasLanguage.com/learn.html

The result of this is that learn.html must exist on the other server (in this case http://StructuredCanvasLanguage.com/). If you want to match any file in /scl and have all requests go to the same location on the new server, you must use RedirectMatchinstead of simply 'Redirect'.

.htaccess Redirect:

Redirect 301 /scl http://StructuredCanvasLanguage.com/

.htaccess RedirectMatch:

RedirectMatch 301 /scl/(.*) http://structuredcanvaslanguage.com

The example above uses a regular expression that matches any file in /scl/ and forwards it to the other domain.



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>