Learning About htaccess Files

Today I learned about the htaccess file. The htaccess file is used to override default configuration of a web server. For example, many web servers will have a default file or files set as to be displayed when typing in a folder path. Usually this default file list consists of something like “index.html,index.htm,index.shtml”. In other cases it may just be “index.htm”, or it may include a number of other files such as “index.php,index.asp,index.jsp” and could even contain “my_weird_file.my_weird_extension” if you really wanted.

The htaccess file is very very powerful. You can use it to redirect paths (perhaps if a file has moved), or if you want to change a hard to remember path into something a user might be able to remember easier.

Something to remember: a directory is affected by all of its parent directories’ htaccess files, not just its own. Order of effect is from its htaccess, up the path, towards /.

[edit]
Also, apparently either WordPress or Apache do not like you to literally type “(dot)htaccess”, where “(dot)” is a “.”. The error returned is not very useful either: “You do not have permission to access post.php”. Ah well, it’s a good security feature of one or the other I suppose.