September 2007 Archive

The Joys of Linux and Command-Line FTP Clients

Sunday, September 30th, 2007

As part of my web hosting dealings I agreed to upload one of my (now ex-) clients’ sites to his new webhost. When I first offered I didn’t consider that the normal command-line FTP client (GNU FTP?) doesn’t recursively create subdirectories and stuff, so it was going to be an intensely laborious manual task of creating about fifty billion subdirectories; i.e. not possible.

As I do in these situations I unhesitatingly turned to Google, which came through with the goods in the form of lftp (lftp man page), a command-line FTP client that has a ‘mirror -R’ (reverse mirror) that mirrors your local directory to a remote site. “Oh, bomb, that’s perfect,” I thought to myself, and gleefully found that it was indeed installed on our ancient Red Hat Enterprise Linux 3 server.

Well ye olde lftp has some quirks and some foibles, at least for the young player like me. The foible I ran into was that lftp tries to make an SSL connection to the target server if it can. In my case it could indeed connect via SSL, but the SSL certificate wasn’t a “real” proper bought SSL certificate, it was a “fake” self-signed cert and lftp didn’t like that one bit. So it would connect to the remote server without complaining but then when I tried to make it do anything it would just refuse and say cd: Fatal error: SSL connect: self signed certificate.

To get around this I had to edit the config file to disable connecting via SSL. I couldn’t find a command-line option to do this so editing the config file was my only option. This involved adding the line ftp:ssl-allow false to the /etc/lftp.conf file, which probably isn’t ideal since that’s for the entire system but pfft, whatever. You can also create a user-specific config file for lftp in your home directory called ~/.lftp/rc if you don’t have full root access or you don’t want to ruin everyone else’s fun ;).

After making this change I reconnected to the remote server with the following commands:

lftp -u newsiteusername newsite.example.com
Password:
lftp newsiteusername@newsite.example.com:/> lcd /fake/local/website/directory
lcd ok, local cwd=/fake/local/website/directory
lftp newsiteusername@newsite.example.com:/> cd fake/remote/website/directory
cd ok, cwd=/fake/remote/website/directory
lftp newsiteusername@newsite.example.com:/fake/remote/website/directory> mirror -R

So that was the end of another enthralling adventure in the land of Linux web hosting.

How To Add Meta Tags to a WordPress Blog

Thursday, September 27th, 2007

Adding meta tags to your WordPress blog is a fantastic idea and one that I have overlooked until now. But a bit of a nudge from this scruffy little fella woke me up to the lack of meta tags on my blog — it seems like WordPress isn’t into meta tags out of the box, and I wasn’t happy.

Glenn Kentwell googling and coding up my meta tag change

Me, googling and coding up my meta tag change!

Matt’s nudge was actually that I should add a meta description tag so that the search engines show an alluring chunk of text beneath my link, instead of the current crap excerpt from that ridiculous post about Brisbane finally getting rain.

So I decided that I need to have my meta description text to be the same as my blog subtitle, known as the “description” to the WordPress application itself. I decided, for now, to go for this:

“Or, 101 ways to improve your social life! And that’s ironclad!”

Who’s not going to click when they read that?

Naturally I was doing a task, so the first step is to google how to do it. I googled for WordPress meta tags and found this Codex article about how to add meta tags to WordPress. It’s pretty easy really. You just need to edit the header.php file of your WordPress theme to include a meta description tag that has the value you want, in my case the text above.

So here’s the code I inserted into the header.php file of my WordPress theme. It uses the bloginfo template tag to display the blog’s description, as you may peruse below:


<meta name="description" content="<?php bloginfo('description'); ?>" />

So, now I just need to wait for the search engines to update their listings and I will be swimming amongst a traffic bonanza. Booya, thanks Matty!

I Fixed My Feed!

Wednesday, September 12th, 2007

That’s right fans, I’ve finally fixed my RSS feed. I thought it just randomly broke, but it looks like I was stuffing around with a random file that actually gets included in the RSS XML and it broke everything. The end.

In other news I’ve been on holidays and got back, and I have tons of photos.

In still other news, we successfully launched the new Suncorp website this week. It’s a massive site and we built it using ASP.NET and C#, with lots of user controls and master pages to help get us through. We had some server troubles at first but now we’re looking good and the site looks like it’s going to hold up nicely. I’m stoked, because I’ve been working on the project since May and it’s great to see it finally come to fruition.