Integrated Search Marketing, Pay-per-Click, and business strategy.
   utilizing technologies usability web marketing portfolio/ resume faqs
html goodies
css goodies
javascript bag o' tricks
website evaluation
white space
newsletter writing
search engine optimization (SEO)
meta tags
branding YOU
Resume: Search Marketing
web portfolio
Article: WebSite Equals ROI
geodemographics
xml
using server side includes
designing store locators
anti-spam laws
 
  html
  stylesheets
  javascripts
  htaccess files
  lorem ipsum

.htaccess files

.htaccess files are like lemon to lemondade. How do you make lemonade without lemons?

Now I know what you're going to say."Ah, there's lots of ways to reuse similar functions and functionality across a website. Especially with the fact that now a days you have all of the object components that have been programmed and are sitting out there on the market waiting for you to buy and use them."

Yes I know, but complicated doesn't always mean better. To clarify, in your toolbox you should always have the basics. That is a hammer, a screwdriver, a pair of heavy duty gloves, an adjustable wrench and so on. This is what an .htaccess file is to you.

In fact it's a bit unfortunate because you hardly hear about them these days. It's like they're too old or something to be considered much anymore. Well I'll let you know right now that you're at a high disadvantage if you aren't aware of this tool at your disposal.

So, here are the basics of putting .htaccess files to use in your website.

  1. Please keep in mind this only works on Unix servers, primarily the Apache web server. Various apache directives are used to enable .htaccess file options. If you are using a Windows server, the .htaccess won't be any good to you.
  2. The .htaccess file takes effect from the top-level directory it is placed in. In other words, if you put your.htaccess file into the root level of your website then all directories under the root are affected.
    So if you only want to enforce certain directives with a sub-directory or folder, then put your .htaccess file in that folder only.

  3. You will need to write it out in a plain text editor such as Notepad or SimpleText. You don't want any formatting in there or wierd ASCII characters lurking in it. In other words, don't type this up in MS Word!
  4. The name of it is .htaccess. This is NOT a file extension such file.htaccess The period preceeds the htaccess part. It is simply named .htaccess
  5. When you FTP it up to your webserver, you will need to make sure that it's done in ASCII mode. This preserves it's original state and doesn't try to convert the actual file format as "binary" mode does.

Okay, with those basics said now, here's what you can do with this little critter.

Standardizing your header, footer, and side navigational structure

This means two things to you.

  1. Having a consistent website - this means that the footer is the same in every page and is the header.
  2. Having only one file to update - for example when you change the copyright year to read 2004 you only need to change one file in your entire site for this to make effect within every webpage that references that file.

Here's the line of code you would use to do this.

AddType text/x-server-parsed-html .html

This is simply saying I want to add an external html file that will parsed by the webserver when a page is called up from the browser.

Shut off diectory browsing

What this means is you disallow someone from snooping around in your directories and sub-directories.

These days now many web hosts set that up for you automatically, so you don't even have to be aware of this. But still what you don't know can hurt you. This is an item that falls in the web security catagory.

Here's the code to do this.

Options -Indexes

If you just want to disallow directory browing for a specific index then you would list that index as such.

Options -images -scripts -docs

Here you would list out the directories you want to block access to.

This writing doesn't cover everything you can do with a .htaccess file. These tricks are simply two of the most valuable tricks I have found I can do with them. See my suggestions below for a more comprehensive .htaccess tutorial.

.htaccess Resources & Tutorials

 
© 2000-2007 StephanieCota.com  |  site map