Showing posts with label htaccess-guide. Show all posts
Showing posts with label htaccess-guide. Show all posts

Aug 17, 2016

Htaccess Guide

htaccess is a very ancient configuration file that controls the Web Server running your website, and is one of the most powerful configuration files you will ever come across. To learn how to take htaccess to the next level, beyond what you thought possible, memorize this: Htaccess Guide





Common Htaccess error, more at

What Is .htaccess ^

Specifically, .htaccess is the default file name of a special configuration file that provides a number of directives (commands) for controlling and configuring the Apache Web Server, and also to control and configure modules that can be built into the Apache installation, or included at run-time like mod_rewrite (for htaccess rewrite), mod_alias (for htaccess redirects), and mod_ssl (for controlling SSL connections).
Htaccess allows for decentralized management of Web Server configurations which makes life very easy for web hosting companies and especially their savvy consumers. They set up and run "server farms" where many hundreds and thousands of web hosting customers are all put on the same Apache Server. This type of hosting is called "virtual hosting" and without .htaccess files would mean that every customer must use the same exact settings as everyone else on their segment. So that is why any half-decent web host allows/enables (DreamHost, Powweb, MediaTemple, GoDaddy) .htaccess files, though few people are aware of it. Let's just say that if I was a customer on your server-farm, and .htaccess files were enabled, my websites would be a LOT faster than yours, as these configuration files allow you to fully take advantage of and utilize the resources allotted to you by your host. If even 1/10 of the sites on a server-farm took advantage of what they are paying for, the providers would go out of business.

My .htaccess files are being ignored.

This is almost always due to your AllowOverride directive being set incorrectly for the directory in question. If it is set to None then .htaccess files will not even be looked for. That is a good thing. If you have access to edit the httpd.conf, you should not use .htaccess files, ever. If your customers do need support for .htaccess, make sure that AllowOverride is set to something sensible (i.e.: Not All). Be certain it covers the directory you are trying to use the .htaccess file in. This is normally accomplished by ensuring it is inside the proper Directory container.

You can tell if this is your problem by adding nonsense text to your .htaccess file and reloading the page. If you do not get a server error, then Apache httpd is not reading your .htaccess file.

Jun 10, 2008

htaccess-guide's .htaccess tutorial

.htaccess Guide
What is .htaccess?
.htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention.


Table of Contents
1. What is .htaccess?
2. How to use .htaccess
3. Error documents
4. Redirects
5. Password protection
6. Deny visitors by IP address
7. Deny visitors by referrer
8. Hot link prevention techniques
9. Blocking offline browsers and 'bad bots'
10. DirectoryIndex uses
11. Adding MIME types
12. Enable SSI with .htaccess
13. Enable CGI outside of the cgi-bin
14. Disable directory listings
15. Setting server timezone
16. Changing server signature
17. Useful Resources