ArticlesBase.com - Free Articles Directory
Free Online Articles Directory
26.07.2008 Sign In Register Hello Guest
Email:
Password:
Remember Me 
forgot your password?


What A .htaccess File Is And How To Make One

Author: Danny Wirken Author Ranking Gold | Posted: 03-11-2006 | Comments: 0 | Views: 625 | Rating:  (73) Article Popularity - Blue (?) Got a Question? Ask.
Sign Up Now!

A .htaccess file is a simple ASCII file similar to that created through text editor such as Notepad or Simple Text. Most people are confused with the naming convention for the file. The term .htaccess is not a file .htaccess or somepage.htaccess because it is the file extension simply named as such. Its widely known use is related to implementing custom error page or password protected directories.

Creating the File

The creation of the file is done by opening up a text editor and saving an empty page as .htaccess. If it is not allowed to save an empty page, simply type in one character. An editor probably appends its default file extension to the name. Notepad for one would call the file .htaccess.txt but the .txt or other file extension need to be removed to enable the user to start "htaccessing". This can be done by clicking the file and renaming it by removing anything that doesn't say .htaccess. It can also be renamed via telnet or the ftp program.

These files must not be uploaded as binary but rather as ASCII mode. Users can CHMOP the .htaccess file to 644 to make the file usable by the server while preventing it from being read by a browser since this can seriously compromise security. When there are passwords protected directories and a browser can read the .htaccess file, the location of the authentication file can be acquired to reverse engineer the list and thereby completely access any portion that had previously been protected. This can be prevented by either placing all authentication files above root directory thereby rendering the www inaccessible or through an .htaccess series of commands that prevents itself from being accessed by a browser.

Most commands in .htaccess are meant to be placed on one line only thus if a text editor uses word wrap, it should be disabled as it is possible that it might throw in a few characters that might contradict Apache. .htaccess is not for NT servers and is considered an Apache thing. Apache is generally very tolerant of malformed content in an .htaccess file.

The directory in which .htaccess file is placed is "affected" as well as all sub-directories. It a user wishes not to have certain .htaccess commands affect a specific directory, this is done by placing a new .htaccess file within the directory that should not be affected with certain changes and removing the specific command/s. from the new .htaccess file which should not affect the directory. The nearest .htaccess file to the current directory is the one considered as the .htaccess file. A global .htaccess located in the root, if considered the nearest, affects every single directory in the entire site.

Placement of .htaccess should not be done indiscriminately as this may result to redundancy and may cause an infinite loop of redirects or errors. There are sites that do not allow the use of .htaccess files because a server overloaded with domains can be slowed down when all are using .htaccess files. It is possible that .htaccess can compromise a server configuration specifically set-up by the administrator. It is therefore necessary to make sure that the use of .htaccess is allowed before its actual use.

Error documents are only a part of the general use of .htaccess. Specifying one's own customized error documents will require a command within the .htaccess file. The pages can be named anything and can be placed anywhere within the site as long as they are web-accessible through a URL. The best names are those that would prevent the user from forgetting what the page is being used for.

Password protection is effectively dealt with by .htaccess. By creating a file called .htpasswd, username and the encrypted password of the people to be allowed access are placed in the .htpasswd file. The .htpasswd file should likewise be not uploaded to a directory that is web accessible for maximum security.

Whole directories of a site can be redirected using the .htaccess file without the need to specify each file. Thus any request made for an old site will be redirected to the new site, with the extra information in the URL added on. This is a very powerful feature when used correctly.

Aside from custom error pages, password protecting folders and automatic redirection of users, .htaccess is also capable of changing file extension, banning users with extra certain IP address allowing only users with certain IP addresses, stopping directory listing and using a different file as the index file. Accessing a site that has been protected by .htaccess will require a browser to pop-up a standard username/password display box. However, there are certain scripts available which will allow the user to embed a username/password box in a website to do the authentication. The wide variety of uses of .htaccess facilitates time saving options and increased security in a website.

Many hosts support .htaccess but do not publicize it while many others have the capability for it but do not allow their users to have an .htaccess file. Generally, a server that runs UNIX or any version of the Apache web server will support .htaccess although the host may not allow its use.

When to Use .htaccess Files

The .htaccess files should not be used when there is no access to the main server configuration file. Contrary to common belief, user authentication is not always done in .htaccess files. The preferred way is to put user authentication configuration in the main server configuration.

It should be used in situations where the content provider needs to make configuration changes to the server on a per-directory basis but does not have root access on the server system. Individual users can be permitted to make these changes in .htaccess files for themselves if the server administrator is unwilling to make frequent configuration. As a general rule, the use of .htaccess should be avoided when possible since configuration can be effectively made in a Directory Section in the main server configuration file.

Two main factors warrant avoiding the use of .htaccess files - performance and security. Permitting .htaccess files causes a performance hit whether or not it is actually used, since Apache will look in every directory for such file. The .htaccess file is also looked into every time a document is requested. The Apache search will include .htaccess files in all higher-level directories to have a full complement of directories of application. As such, each file accessed out of the directory results to 4 additional file system accesses even if none was originally present.

The use of .htaccess permits users to modify server configuration which may produce uncontrolled changes. This privilege should be carefully considered before it is given to users. The use of the .htaccess files can be completely disabled by setting the Allow Overide directive to none.

Rate this Article: Current: 1 / 5 stars - 1 vote(s).

Article Source: http://www.articlesbase.com/communication-articles/what-a-htaccess-file-is-and-how-to-make-one-69743.html

Print this Article Print article   Email to a Friend Send to friend   Publish this Article on your Website Publish this Article   Send Author Feedback Author feedback  
Submitting articles has become one of the most popular means of generating quality backlinks and targeted traffic to your website. Join us today - It's Free!

Article Comments

Comment on this article Comment on this article
Your Name
Your Email:
Comment Body
Enter Validation Code: Captcha


Related Articles

Using Writely As Your Blog Editor
By: Danny Wirken | 16/09/2006 | Communication
Internet giant Google has acquired Writely, an online web processor that also functions as a blog editor.

Recovery From PC Failure Using Windows XP's Restore Point
By: Otis Cooper | 19/10/2006 | Advertising
Have you ever done something to make an improvement and later regretted it?It would be awesome to be able to go back in time and undo the the thing that were supposed to make an improvement.

B2evolution---software With the Most Comprehensive Feature List
By: Fat Jack | 18/07/2007 | Software
No matter if you do not belong to IT fraternity; what you need is the right kind of vision to start a blogging website. Worried over the technical aspects of uploading and maintenance of the site? That can be handled by an efficient webhost, whose duty is to arm you with range of proper tools and software; when you can concentrate on the contents of the website, the software will take care of the technical matters related to running of the website. Read the article to learn about the B2Evolution software—the most favorite blogging software among the bloggers.

Global Communication is About to Evolve Again!
By: Barbara C. | 14/11/2007 | Technology
The future of the Internet is here! Just imagine the possibilities of an Internet connection that is 8 times faster than DSL and costs $19.95 a month. How about unlimited cell phone coverage for $9.95 a month.

Advantages of Open Source Software
By: Fat Jack | 18/07/2007 | Software
Be it the content management system or a blogging engine, a wiki supporting solution or a comprehensive project management system----the open source software are what rule the industry. The paramount position of these open source web- applications point to a single fact---they have certain advantages over their commercial counterparts. The article discusses about the several advantageous features of open source software.

Why Is Wireless Technology Is Taking Over How We Live ?
By: Jason Roberts | 24/09/2006 | Advertising
Wireless Internet technology, also known as WiFi, is really taking over the way people access the Internet and it has become widely popular in a very short time.

EVER GOT BUSTED BY THE WORLD WIDE WEB? MySpace-ers and Forumgoers Swap Opinions: This is a Great Web-Advertising tool
By: Brian Hull | 20/07/2006 | Press Releases
A new website called sweepandswap.com, designed by a young, U.S. entrepreneur, changes a computer's Internet history by substituting visited websites with sites that are pre-screened for content and removes previous versions of the Internet history from the computer - all with one click. These pre-screened websites, called SwapSites, are sponsored by website owners who want to experience this new level of advertising. Sweep and Swap is a one-click way to protect your online privacy.

Automated Information Tracking on the Internet
By: Phil Morettini | 20/10/2006 | Marketing
I wanted to make you aware of another cool Web-based, free resource that I've become aware of and have started using.

Got a Question? Ask.

Ask the community a question about this article:

Frequently Asked Questions

Need software to input rental units potential cap rate
By: righthome | 16-07-2008
I am considering some rental units ( mostly duplexes to fourplexes ).  Need user-friendly software to analyse best unit(s) invesment.  Using purchase price, down payment, monthly & annual operating expenses,  rental income.    Building depreciation, etc, might be a little advanced for my needs.  However, if the software includes this capability, it would be great. Please advise which one i can purchase for my needs. Thank you, Carol russell     

Internet explorer opens a whole bunch of times by itself
By: brianofcancun | 16-07-2008
...I closed Windows Internet Explorer and then it reopened by itself....then again and again as I watch the monitor...in sort of rapid-fire...I turned around and there were 14 Internet Explorer Windows open...all of them "blank" (white)...what gives???

Best Software
By: doober | 15-07-2008
I have a CD software called Memories on TV love what you can do but does not play on DVD players that I have. So I want to know what software out there is the best for creating your photos in to CD with music and different effects? Also what is the best software for editing your old photos.   Thanks Doober

Are there any free practice tests for the medical ...
By: labtch | 14-07-2008
Are there any free practice tests for the medical technologist certification exam ?

I was wondering if anyone knows bout any kind of ...
By: cattman | 14-07-2008
I was wondering if anyone knows bout any kind of software that i could use to see a car in 3-D and beable to change the paint job, the rims, the tint, and ext.

Hi, im Adam Im opening up a custum car shop and ...
By: cattman | 14-07-2008
Hi, im Adam Im opening up a custum car shop and im looking for a computer software that I can use to see what the car will look like before I actually remodel it. I need it to beable to change the tint, paint, rims, neon, ext. If u have any idea of any softwear like this let me know please.

Q&A Powered by:
Powered by Yedda 

Latest Communication Articles

Samsung G600 - Now Enhance Camera Skills Through Phone
By: Adam Caitlin | 25/07/2008
Mobile phones in this high technology world have become part and parcel of life and have evolved out as a technological icon in modern day world. Among present day mobile phones, Samsung G600 is a great and savvy handset with modern technology.

Nokia 6236i Cellular Phone
By: Monty Alexander | 25/07/2008
The Nokia 6236i is designed to appeal to a wide range of users with a slim form factor, classic chrome accents and a number of features including a 65,536 color screen, VGA camera, streaming video capability and an integrated FM radio. A built-in speakerphone and voice recorder add a high level of convenience, while high-fidelity MP3 ring tones and streaming video capability add a high level of entertainment.

Free Icons
By: Robert | 24/07/2008
We have animated icons, funny icons, naughty icons, and pretty much any other emoticon you can think of.

Recording Calls on a Telephone Network Vs Hosted Call Recording
By: PXR5 | 24/07/2008
Many telephone networks and providers are now bundling phone call recording systems in with their line rental. Whilst these services may be useful for some businesses, they are not without their flaws...

More and More Businesses Using Call Recording Equipment
By: PXR5 | 24/07/2008
More and more businesses across the UK are experiencing the benefits of using phone call recording equipment These systems are becoming increasingly popular in a variety of industries and sectors...

Is Cheap Broadband About to Go the Way of Cheap Petrol, Cheap Flights, Cheap Rice...?
By: Shirley Stevens | 24/07/2008
BT is keen to increase the amount they charge broadband providers to access its telecom services and Ofcom (the communications watchdog) is considering granting BT permission to do so. If this transpires, cheap broadband deals may well become a thing of the past. However, there is no need to be too concerned just yet, as we explain.

Geemarc’s New Amplified Telephone
By: PXR5 | 24/07/2008
Telecoms manufacturer Geemarc has launched a new amplified telephone as part of their Clearsound range. This new handset has been designed with those with hearing impairments in mind.

Nokia N95: a True Blend of Sophistication and Style
By: Adam Caitlin | 24/07/2008
Nokia N95 is a widget that has got all kinds of possible qualities that makes it a superior mobile gadget then the rest mobile devices existing in the market.

More from Danny Wirken

Riya: A Big Leap In Visual Search Engines
By: Danny Wirken | 16/11/2006 | Communication
Watch out for new software that will give a new face to search engines. Rather, a program that includes faces in the search function. A new California-based company, Ojos, developed the online photo-based search service named Riya.

Web 2.0, A Guide For Newbies
By: Danny Wirken | 04/11/2006 | Communication
A couple of years back Bill Gates introduce the idea of Convergence to the public. It was a fresh idea that later became a catchphrase for the Internet Industry.

Trackback Spam Explained
By: Danny Wirken | 04/11/2006 | Communication
In most blog applications, there is a feature called Trackback, which allows the user to send a trackback or notification to a different site or another blog that the user referred to in his own blog.

To Blog Or Not To Blog: The Ups And Downs Of Blogging
By: Danny Wirken | 04/11/2006 | Communication
Whenever the subject of the phenomenon called blogging is raised, most people immediately think associated it with an online diary or weblog. The term weblog refers to key words. First is web from the World Wide Web and log, as in keeping a log.

Tips On How To Deal With Anonymous Comment Spam
By: Danny Wirken | 04/11/2006 | Communication
Have you ever experience being flooded with anonymous comments? If yes, then chances are you have been a victim of comment spam. As with everything on the Internet, spam had also evolved. They are no longer limited to email.

The Latest On WordPress Themes
By: Danny Wirken | 03/11/2006 | Communication
As WordPress and blogging become more and more popular, the list of customization options continues to grow. One can attribute that to each user wanting his or her blog to be unique or very much personalized.

The Exciting World Of Video Blogging
By: Danny Wirken | 03/11/2006 | Communication
When the idea of weblogs was first introduce online, it was an instant phenomenon. Suddenly just about everyone feels the need to create their own space online by writing their thoughts. Then podcasting was introduced—blogging in audio form.

What You Newbies Need To Know About Pay Per Click Ads
By: Danny Wirken | 03/11/2006 | Communication
Just about anyone who has been using the Internet in the last few years has no doubt come across the term "pay per click" once or twice. Pay per click is actually one of the less expensive, albeit efficient, forms of advertising online.

Article Categories






Give Feedback

Sign up for our email newsletter

Receive updates, enter your email below