Difference between revisions of ".htaccess"

From Wiki Notes @ WuJiewen.com, by Jiewen Wu
Jump to: navigation, search
(Important Notes)
Line 21: Line 21:
 
By the way; the windows screencap is more recent than the mac one, moved files are likely being handled by my clever 404 script.
 
By the way; the windows screencap is more recent than the mac one, moved files are likely being handled by my clever 404 script.
  
+
** even notepad can save files beginning with a dot, if you put double-quotes around the name when you save it; i.e.. ".htaccess". You can also use your ftp client to rename files beginning with a dot, even on your local filesystem; works great in FileZilla.
 
 
    ** even notepad can save files beginning with a dot, if you put double-quotes around the name when you save it; i.e.. ".htaccess". You can also use your ftp client to rename files beginning with a dot, even on your local filesystem; works great in FileZilla.
 

Revision as of 19:08, 7 March 2009

.htaccess tips and tricks

Important Notes

This article was originally posted here.

Introduction

Introduction to .htaccess.. This work in constant progress is some collected wisdom, stuff I've learned on the topic of .htaccess hacking, commands I've used successfully in the past, on a variety of server setups, and in most cases still do. You may have to tweak the examples some to get the desired result, though, and a reliable test server is a powerful ally, preferably one with a very similar setup to your "live" server. Okay, to begin..

..a win32 Apache mirror of corz.org peecee Explorer view with invisible files .htaccess files are invisible

There's a good reason why you won't see .htaccess files on the web; almost every web server in the world is configured to ignore them, by default. Same goes for most operating systems. Mainly it's the dot "." at the start, you see?

If you don't see, you'll need to disable your operating system's invisible file functions, or use a text editor that allows you to open hidden files, something like bbedit on the Mac platform. On windows, showing invisibles in explorer should allow any text editor to open them, and most decent editors to save them too**. Linux dudes know how to find them without any help from me. Mac Finder view with invisible files that same folder, as seen from Mac OS X


In both images, the operating system has been instructed to display invisible files. ugly, but necessary sometimes. You will also need to instruct your ftp client to do the same.

By the way; the windows screencap is more recent than the mac one, moved files are likely being handled by my clever 404 script.

    • even notepad can save files beginning with a dot, if you put double-quotes around the name when you save it; i.e.. ".htaccess". You can also use your ftp client to rename files beginning with a dot, even on your local filesystem; works great in FileZilla.