Web Development

What is an htaccess file? What can I do with the htaccess file?

A short primer on the basics of an htaccess file, what you can do with it, and why you need it.

2 years ago

If you've reached this page, it's a fair bet you already know something about the htaccess file. You know it's used by websites to do... something, but you're not quite sure what. Let's break it down!

First, what are the basics of an htaccess file?

  1. It doesn't have a filename, and its extension is always .htaccess.
  2. Normally, you want to put it in the root directory of your website (usually public/ or public_html/).
  3. .htaccess defines a set of rules that will apply to files in that folder and all subfolders.
  4. The 'ht' stands for hypertext. The 'access' stands for... access.
  5. Otherwise, it's just a normal plain text document.

That's pretty much all there is to it. Keep in mind though that since the .htaccess file does not have a filename, we call it a hidden file. This means that sometimes when using an FTP program or a file manager, you may need to look for and enable an option that says "show hidden files."

.htaccess goes in the root web directory (public/ in this case). Make sure that your FTP program or file manager has the option "show hidden files" enabled.

Really, all you need to know about the htaccess file is three things: it's just (1) a normal text file (2) called .htaccess (3) that goes in the main website directory. That's it.

So, what can we do with the htaccess file?

We can do lots of great stuff with the htaccess file. We can:

  • Tell web browsers to cache static assets (stylesheets, javascript files, and images) for better performance
  • Redirect visitors to a maintenance page when we take our site temporarily offline
  • Ban visitors by IP address
  • Password protect directories
  • Get rid of ugly .html and .php extensions in the url

And that's really just the tip of the iceberg! Overall, it's a really powerful file that can be used to speed up response times, improve the user experience, and contribute to world peace.

Post Comments(12)


<a href=https://cialiswwshop.com/>buy cialis online forum</a>

1 day ago


<a href=http://vsantabusev.com/>antabuse online pay with paypal</a>

2 weeks ago


<a href=http://vskamagrav.com>kamagra usa sales

1 month ago


<a href=https://sscialisvv.com/>buying cialis online reviews

1 month ago


<a href=http://vslevitrav.com/>buy levitra professional

2 months ago


https://vskamagrav.com/ - order kamagra bank cheque

3 months ago


Propecia Liver Damage Keratin Aliclescadia <a href=https://xbuycheapcialiss.com/>cialis prescription</a> felpnoretelt Prix Kamagra Au Maroc

7 months ago


<a href=https://lexapro2020.top/>lexapro2020.top</a>

10 months ago


Meds information for patients. Generic Name. <a href=https://lexapro2020.top/>lexapro generic tablets</a> Actual what you want to know about medicine. Get now. Medicine information. Brand names. <a href=https://orderprozaconline.top/>where to buy prozac 20 mg without insurance</a> Everything trends of drug. Get information here. Medication information leaflet. Drug Class. <a href=https://buyprozac247.top/>cost of prozac 20 mg prices</a> Some news about medicines. Read information here.

11 months ago


Medication information sheet. What side effects can this medication cause? <a href=https://lexapro2020.top/>where to buy cheap lexapro 10 mg tablets</a> Medication information for patients. What side effects? <a href="https://lexapro2020.top/">can you buy lexapro 10 mg prices</a> Best trends of pills. Read now. Drugs information sheet. Generic Name. <a href=https://orderprozaconline.top/>where can i get cheap prozac no prescription</a> <a href="https://orderprozaconline.top/">how to get prozac 20 mg without a prescription</a> Actual information about medicament. Read information now. Medicines prescribing information. Long-Term Effects. <a href=https://buyprozac247.top/>where to buy cheap prozac 20 mg price</a> <a href="https://buyprozac247.top/">price of cheap prozac rx for sale</a> Best trends of meds. Get now.

11 months ago


Purchase Prevacid Online https://cheapcialisir.com/# - Cialis Viagra Tarifs <a href=https://cheapcialisir.com/#>cialis online pharmacy</a> Zithromax While Pregnant

1 year ago


Need Secure Ordering Clobetasol Medicine http://apcialisle.com/# - Buy Cialis Viagra Diario <a href=http://apcialisle.com/#>cialis price</a> Order Levothyroxine Canada Online

1 year ago

Leave a reply