Htaccess: Introduction

Revision as of 13:23, 29 June 2008 by Ric (talk | contribs) (New page: <span id="top"></span> <div style="padding:0;margin:0; border-bottom:3px inset #000000"> {| | MPG UniCenter || .htaccess: [[Htaccess: Introduction | Introduc...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

.htaccess - Apache directory-level configuration file

The .htaccess file is a simple ASCII file it provides an easy method to extend the Apache configuration file you edit this file with a text editor such as NotePad never use a word processor to do this because they add extra formatting characters.

This section provides a detailed description of some commands you can use in this file a more concise and quick reference guide can be found on this page HT.

Whats in a name

In Unix, files beginning with a period ( . ) typically hold settings for programs these are refered to as dot files. Apache is a Unix application ported to Windows for cpmtatabilty retains this naming convention. For all Windows users the file .htaccess is just that a file; at first it looks strange but that's it's full name it has no extension or anything before the dot.

Create the file

The easiest way to create the .htaccess file is just to copy an exiting one into its new location and edit its content. The problem in creating a new file from scratch is that most windows text editors (Window Notepad is no exception ) will insist on adding a dot txt extension so the file looks like this .htacces.txt even trying to rename this file Windows XP insists on a file name.

Note: Most commands in htaccess are meant to be placed on single line only.

Several htaccess files

You will find several htaccess files in Uniform Server do not edit these they are part of Uniform Server's security. That said the one contained in root folder WWW is placed there for you to edit, it allows you to put your server online. You can copy this file into any folder you create within your website and edit it to meet your needs.

What it affects

The htaccess file affects the folder it is placed in and all sub-folders. The htaccess file located in your root folder (folder WWW) affects your website and all folders and files below it.

You can tailor this action so it does not apply to a specific folder by copying the htaccess file to that folder and removing the htaccess commands that you do not want to be applied to this folder and it’s sub-folders.

From the viewpoint of a folder or file it is the nearest htaccess file that affects it.

What can you do with it?

Uniform Server places no restrictions on what can be contained in the htaccess file. Hence htaccess examples found on the Internet or from textbooks should work. I have included a few to get you started.

Top


  Ric