Yesterday, I wanted to put something in a .htaccess file and then ftp the file over to my site that is hosted in the UK. Only one issue, I needed to make sure that I wouldn’t override the one that I had — just needed to add to it. So, my plan was to download the .htacess file and then add to it the necessary apache directive to have the webserve gzip my css and js files — it’s supposed to really speed things up — and then ftp it back to my site.
My desktop uses Windows XP while my site resides in a Linux environment. I read somewhere online that I could make .htaccess files visible if I tinkered with MS Explorer. If you select Tools and then Folder Options, there is a File Types Tab, and if you click the identically named label below it, you will see an alphabetical listing of file types on your system. And, you can even add a new file type. So, when I indicated that I wanted to add a new file type, I was asked to provide the extension, i.e. not the dot — just the extension. So, I added HTACCESS and then all such files magically appeared on my desktop system. But, they were still invisible on the right pane of my ftp client which corresponds to my hosted site on the other side of the Atlantic. Since I only have FTP access to those files, i.e. I am unable to use SSH or SCOPY, I wondered how I would get a chance to inspect my HTACCESS file at the remote url.
My intuition suggested that there had to be another way. So, I decided to do things the old-fashioned way and work at a command-line prompt.
On Windows, for some reason if you want to open a shell, that command is listed under Programs->Accessories — at least that goes for Windows XP 2003. Once, I opened a shell, the easy part was typing the command ‘ftp’ which changes the C prompt to one that reads ‘ftp>’. From this point on you need to use the correct commands and syntax for ftp. If you can’t remember, you may type ‘help’ and then all the ftp commands come into view.
I recalled that the command ‘open’ needed to be typed and when I did so, the word ‘To’ appeared. At this point, I provided the ftp url for my site in the form of ftp.mysite.com. Next, I had to supply a username and password which is information that I’ve permanently saved in my windows ftp client, so that I wouldn’t have to remember such data. Fortunately, I knew where I could recover the requested credentials and successfully connected to my site — yay!
Once connected, I then remembered that I needed to change directories to where my .htaccess file was located. It was a little weird to be issuing the DOS cd command knowing that my site runs on linux but the command worked and I was able with another DOS command dir, to see which sub-directory contained the .htaccess file.
The next challenge consisted in trying to figure out how to get the file onto my desktop. The command that finally worked was appropriately called ‘get’. It’s a good thing that I bothered to review the .htaccess file instead of over-riding it with a new one. The file contained in it other commands that I would have regretted wiping out.
After I fetched the htaccess file and amended it, I was able to then send it back using my WS_FTP client as it did appear in my left panel which represents my desktop’s hard-drive.
Had I been dealing with sensitive information, I probably would have done things differently because I am sure that the command-line FTP allows the information to be transported as clear text.
In sum, the old-fashioned ways of doing things before there ever was a GUI, can still come in handy, even today.