Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I only have a basic understanding of .htaccess files. What are some tasks that can be accomplished using them? What are good resources that would aid in learning how to use them on a more advanced level? What are downsides/risks/etc to using them? What are benefits to using them?

share|improve this question

closed as not a real question by John Conde Mar 12 '11 at 1:31

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
This is still way too broad. If you want to learn about .htaccess Google it. If you then have any specific questions come back and ask them here. –  John Conde Mar 12 '11 at 1:32
    
Sometimes its nice to get input from people with experience before doing research. Saves a lot of time and would be useful for others. –  Kenneth Mar 12 '11 at 2:00
    
Unfortunately that doesn't meet the requirements set forth in the faq –  John Conde Mar 12 '11 at 2:03
    
Other SE's don't seem to have a problem with it. –  Kenneth Mar 12 '11 at 2:05
    
I disagree. I see vague questions like this closed at StackOverflow all the time. Either way, it still doesn't meet the criteria set forth in this FAQ which is what matters. –  John Conde Mar 12 '11 at 2:24

1 Answer 1

up vote 1 down vote accepted

.htaccess (hypertext access) files are essentially a per-directory Apache configuration file. Whatever configuration options you put in that file will apply only to the contents of that directory including its sub-directories.

What you can do with htaccess files depends on how your specific Apache install is configured. Generally, you can use set, for instance PHP runtime flags, as well as control viewing permissions, password protection, directory indexes, and rewriting urls.

Apache's online documentation has a great tutorial to .htaccess files.

The risk of using an .htaccess file is misconfiguration. If you cause a syntax error in an .htaccess file, Apache will throw HTTP 500 errors to the client making your directory and everything under it impossible to access via web. There is no official .htaccess syntax validator that I'm aware of but you can try this one.

There are tons of great benefits to using .htaccess files. Because they are called on every request they apply to (which could turn into a performance issue for some), configuration takes place immediately and you don't have to reload or restart Apache. They are ideal for, and often used on, shared web-hosting because you won't have access to Apache's main configuration file(s).

share|improve this answer
    
Thank you for your answer. –  Kenneth Mar 12 '11 at 3:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.