Mobile app version of vmapp.org
Login or Join
Barnes591

: Uses of .htaccess files 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

@Barnes591

Posted in: #Htaccess

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Barnes591

1 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

.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).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme