Redirects with .htaccess

I may have come up with a solution for the RSS errors I’ve been seeing.

When I combined Maria Langer, the Official Web Site* with my personal WebLog and LangerBooks.com, my book support site, into one site at www.aneclecticmind.com, I soon realized I had a problem. A bunch of people who were accessing the RSS feed for my old Mac OS X VQS book support site were still looking for it at the old address. Trouble is, it wasn’t there anymore. So these feed readers were looking for something they’d never find. And rather than give up and get on with their feed reader lives, they evidently kept looking, day after day, week after week. The people following the feed were probably either too overwhelmed by other content to notice my absence or had the silly idea that I just wasn’t writing anything new.

I discovered this, by the way, by checking the Users Online feature of my site. If I had a bunch of users online, I’d pop over to that page to see what they were looking at. I noticed that some of them were looking at my Oops! Page Not Found page. And when I pointed to the URL link, I saw that the page they were trying to get was the feed page for the Mac OS X books.

What could I do? I didn’t know. But the problem always bumbled around in the back of my mind. I figured I’d resolve it sooner or later.

Today, while waiting for a friend I’d taken to the doctor’s office, I killed some time listening to podcasts on my iPod. One of them was a podcast I’d only recently subscribed to: Podcasting Underground. In one episode, the host brought up a problem he’d experienced using redirects in his podcast feed. Although I didn’t have the same problem and his solution didn’t apply to me, it got me thinking. Redirects. Of course!

To those of you who don’t know, a redirect is an instruction that tells the visitor to Web content that the content isn’t available where he’s looking but is available elsewhere. It redirects him to the correct place.

There are at least two kinds of redirects — at least two kinds that I know about, that is.

One is extremely basic and uses an instruction in the head element of a Web page to send the visitor elsewhere, occasionally with a timer. Whenever you go to a Web page that says “We’ve moved to http://blahblah.com. Click this link if the new page does not appear automatically in five seconds.” That page has a redirect with a five second delay. It’s an easy redirect to create (if you have HTML knowledge) but it does waste time and effort by letting the visitor go to the wrong place in the first place. It also requires an HTML document at the wrong location. Not very smart, if you ask me, but it does have its purposes.

The other redirect requires rolling up the sleeves and editing the invisible .htaccess file that can live in a variety of places on a Web server, including the server’s root directory, a Web site’s root directory, or a specific directory within a Web site. This file can contain all kinds of instructions, as you can learn about in the Comprehensive Guide to .htacess or elsewhere online. (Just Google .htaccess and don’t forget the leading period or “dot.”)

The only instruction that interested me was the redirect command. It uses the format:

Redirect olddirectory/oldfile.html http://www.newsite.com/newdirectory/newfile.html

So I composed a command string that I think should work, stuck it in my .htaccess file, and resaved the file to my server. The new file location is set to the RSS feed for this entire blog. I figure they can always come back and change their subscription for the specific content they want.

Now it’s wait and see. I’ll keep peeking at the Users Online page to see if there are any people on the error page, then point to the URL to see what they were trying to find. If it’s the old RSS feed file, I’ll tweak my .htaccess entry accordingly. So far, I’ve only had to tweak it once…it looks like it might actually be working.

Oh, and by the way, if you’ve found this article through an RSS feed that you haven’t seen activity in for about six months, welcome back! You’re one of the readers I lost to this error. Visit the RSS Feeds page and subscribe to the content you want. I promise I won’t move the RSS feed addresses again without a redirect.

And if you know any other good online resources for .htaccess information, please use the comments link to share their URLs with readers.

.htaccess, howto, redirect, 404, RSS, feed

NateMail

A good e-mail form processing tool.

While I’m praising software developers, I really ought to take a moment to mention Nate Baldwin, author of NateMail. NateMail is an excellent PHP script for handling e-mail forms.

Here’s the problem. E-mail harvesting robots are programs used by spammers to gather e-mail addresses posted on the Web. They go through Web sites and pull in anything that looks like an e-mail address — for example name@domain.com. (That’ll cause some spam bouncing.) That address gets added to their spam lists and the addressee gets spam.

It doesn’t matter if the address is visible to a Web site visitor as text on a Web page or encoded as a mailto link in the source code of the page. The robot will find it and grab it.

This poses a challenge for Web site developers who want to include a contact method on their sites. If you enter your e-mail address or provide a link to it, it’ll be gathered and spammed.

Enter NateMail (and other programs like it). They work with e-mail forms like the one you’ll find on my Contact Me page and the Contact Us page on wickenburg-az.com. My e-mail address does not appear anywhere on the form, either visible to the site visitor or in the page’s source code. Instead, the form calls NateMail, which has the e-mail address embedded in it. Because NateMail is located where the robots can’t find it (outside the Web directory), my e-mail address remains invisible to the robots. This prevents my e-mail address from being harvested for spam, thus greatly reducing the amount of spam I get.

NateMail is easy to configure and use. Of course, it does require PHP to work, so if you don’t have a PHP compatible server, it’s of no use to you.

One of the neat features of NateMail is that it supports multiple e-mail addresses. So a form can include a menu of addresses and NateMail will send the form to the addressee that’s selected by the sender. You can see this on wickenburg-az.com, where I used it to allow mail to be sent directly to the site’s regular contributors.

NateMail is free, although donations are always accepted. I liked NateMail so much that I bought Nate’s other program, ProcessForm, for $15. It does what NateMail does and more, including accepting file attachments. When I have time, I’ll set it up on wickenburg-az.com so visitors can e-mail photos for publication on the site.

WordPress Power

I start to tap into the power of WordPress for Web publishing.

WordPress is an Open Source blogging tool. At least that’s how it’s promoted. But it’s so much more than that.

WordPress is a highly customizable Web publishing platform. With WordPress, a server, and a little ingenuity, you can build a Web site with nicely formatted static and dynamic pages. New content can be added by anyone you give access to. Site visitors can add comments — if you allow them to. Best of all, because it’s based on a blog engine, blogging features apply: date-based content display, automatic archiving of content, support for pinging and trackbacks — the list goes on and on.

I started getting a real feel for WordPress when I started rebuilding wickenburg-az.com, a Web site I have been maintaining since 1999 to provide information about the town I live in, Wickenburg, AZ. I started off keeping it simple, choosing a nice looking theme called Connections by Patricia Muller to control the appearance of the site. I immediately started tweaking the theme, changing the link colors and the header image. Then, after I had some content added, I continued tweaking by adding more features: automatic article author images, Webcams, random list of articles on topics pages, random header images, site statistics, weather, donation button, calendar of upcoming events, and Technorati tags. I added some “under the hood” features, too: comment spam protection, automated database backup, and sticky posts (which can glue a post to the top of the Home page until I release it). Right now, I’m trying to add the Users Online feature I have on this site, but I’m running into a page formatting problem and still need to work out the details to get it to work.

Every change I make to the site teaches me something about the way WordPress works. I learn more about HTML, PHP, CSS, MySQL, and Apache every day. For years, I’ve avoided digging deeply into advance Web publishing coding because I knew so little about it. Now I’m forcing myself to learn by working with it daily. I love the challenge. And I love applying the things I learned yesterday to the things I do tomorrow.

I’ll be writing more about WordPress in the weeks to come, so if you’re a WordPress user or are just curious about it, I hope you’ll keep checking in. Together, we’ll learn more about this great Web publishing tool.

Welcome to the New Home of Maria’s WebLog

I combine Maria’s WebLog and the Maria Langer Web site into one site, using WordPress software.

You’re looking at the new home of Maria’s WebLog, which I’m in the process of combining with my personal Web site. If you’ve been following my WebLog, you know that I recently installed Mac OS X server on my old G4 and made the switch to WordPress to rebuild the wickenburg-az.com Web site I host there. This is the second big project for that server, and it’s quite a challenge. Not only do I have to get hundreds of pages of content from both sites together in one central place, but I have to modify the theme on which the appearance of the site is based — without knowing nearly enough CSS or PHP code to get the job done easily.

I do love a challenge.

So bear with me as I get this site put together. Your suggestions and comments are always welcome. Use the Comments link to let me and other visitors know what’s on your mind.

Moving Web Sites

I begin my server project by finding temporary homes for the 18 domains I host.

Rather than try to rush through the server configuration and get it done in a day, I decided to take my time about it. As a result, my Web server is likely to be down for several weeks.

Of course, I can’t keep my Web sites down for several weeks. Although most of the 18 domains I own are mine and support my own personal business endeavors, more than a few are for other people’s businesses. These are businesses I’ve created Web sites for as favors or in return for other goods or services. Although I’m not being paid to maintain the sites, I don’t feel that I have the right to cut them off for a few weeks. And for the few sites I do receive income for, I obviously owe my clients uninterrupted service.

The solution, of course, was to move the sites onto another server for a month or so. I chose GoDaddy.com, which offers inexpensive, feature-rich Web hosting that includes lots of bandwidth and disk space for a very reasonable monthly fee. GoDaddy also has very good customer service by phone (the e-mail based customer service stinks and is not worth the effort). Best of all, I had already registered most of the domain names on GoDaddy.com, so setting up the sites to be hosted there would be quick and easy.

Easy, yes; quick, well, not really. For each domain, I had to set up and pay for a hosting account. GoDaddy no longer allows just one-month hosting contracts; there’s a minimum of two months. That’ll give me more time but cost me about twice what I thought I’d pay. Not a huge deal, because the prices are very affordable. Then I had to tell GoDaddy what domain was being hosted at the new site, thus setting up a new FTP account on the server. I had to go to my domain list and change the DNS settings for that domain so they’d point to GoDaddy’s DNS server.

The big trick was to get the site files to the new server before anyone would be visiting. Normally, I’d use ftp with the domain name (for example, ftp.aneclecticmind.com) with the login settings to connect. But since I’d just changed the DNS server settings, using ftp with the domain name would have pointed me to the server in my office. I had to wait for the domain to be fully propagated through the DNS system to find it using the domain name. So instead, I figured out how to track down the IP address of the new server and I used that for FTP. It worked like a charm. I was able to upload all the site files to the new server so they’d be there when the first visitors arrived.

I had to go through this process for most of my domain names. I say most because a few domain names are for the same site. For those, I tweaked the DNS settings on GoDaddy.com to set up domain forwarding. For example, wickenburgaz.com and wickenburg-az.us point to wickenburg-az.com. This saves me money, of course, because I don’t have to set up a separate hosting account for each of the wickenburg-az.com domain names. To save time, effort, and money, I had a few other domains point to existing domains. For example, I also pointed flyingmproperties.com and wickenburgairport.com to wickenburg-az.com. Although these are separate sites, they’re small and don’t really need to be separate for the next few months.

I was doing fine until I got to langerbooks.com. During the hosting account setup process, GoDaddy’s server had some kind of hiccup and gave me an error message. As a result, the hosting account is set up, but the domain manager there doesn’t recognize the domain as being hosted on GoDaddy. That means I can’t change the DNS settings to GoDaddy’s DNS server. Which means that although the langerbooks.com site is all ready to be visited on GoDaddy’s server, no one will ever find it there because the DNS still points to my server. This is a royal pain in the butt that I’ve been tackling with GoDaddy tech support for the past four days. They say the problem effected several users, and is being worked on, but nothing seems to be getting done. If it isn’t fixed by tonight, I’ll have them delete the hosting account and I’ll start all over.

The only other challenge was for the one site I host that I don’t control the domain name for so I couldn’t easily access the DNS settings. Actually, there are two of those. One of the domains is registered on GoDaddy.com, so it was just a matter of setting myself up as an administrator (or “exec” for the account) and making the DNS change. The other is registered with Network Solutions, which I definitely do not recommend (despite what I wrote in a book several years ago). Network Solutions overcharges for domain name registration — they cost roughly 4 times what GoDaddy does — and they don’t offer nearly as many features, options, or services. But they’re also very difficult to get your domain name away from and my client, who owns the domain, would rather overpay for domain registration than try to tackle the change process. It’s his money. I’ll try again later this month to show him the light.

Anyway, I had to go to his office, where his office manager logged into his account on Network Solutions so I could make the change. It only took a few minutes. I expect the DNS to be fully propagated by the weekend.

The next task was to change where the ssi ini files were being copied to. These files are generated each morning by FileMaker Pro. There are four of them. almanac.ini displays information about the sunrise, sunset, moonrise, moonset, and length of day for the current day and the next day. This information is used by wickenburg-az.com and wickenburgairport.com. sunrise.ini displays sunrise information for the next seven days. sunset.ini displays sunset information for the next seven days. These two files are used by flyingmair.com to display current information for its Sunrise and Sunset tours. calendar.ini displays information about the next event on the wickenburg-az.com event calendar and is used on the wickenburg-az.com home page.

These files are created on my Web server computer and just saved in the appropriate Web folder. But now the files needed to be sent via FTP to the servers where the sites resided. I used an AppleScript to give the instructions to Fetch. FileMaker Pro would trigger the script when it finished generating the files. I just checked it and it doesn’t seem to be working quite right. I’ll have to check it again when I go into the office later today.

The only other change was to set where the webcam images would be saved and make sure the sites would point to the right place. I decided to send all the Webcam images to theflyingm.com, which will continue to be hosted on GoDaddy.com’s servers. I use that domain name for all my podcasts, book sample files, and other large files I don’t want to host locally. The connection is faster and there’s tons of bandwidth and disk space available. It’s a great deal.

So that’s where the project stands so far. The only thing holding me up from taking the next step is the problem I mentioned with langerbooks.com, which will be resolved, one way or another, this weekend.

I’ve done a few other things with the server. I added 512 MB of RAM the other day. I’d tried this two weeks ago, but the RAM I bought was bad. This was the replacement RAM, sent for free from the dealer, All4Memory. I recommend them.

Since I had all that RAM on board, I set up another program to work for me. Audio Hijack Pro is now set up to record the incoming streaming audio from KBSZ. It’ll record the 8 AM news (for immediate and automatic distribution at 8:20 AM), the 9 AM Around the Town show (which will require some tweaking to convert into a podcast), and the first hour of Miss Holley King’s Rock-a-Billy & Beyond show on Saturday mornings (which will also be converted into a podcast). This will save me a ton of time; I won’t have to transfer Around the Town episodes from cassette tape to my computer.

I’m having a lot of fun thinking up things for my server to do for me. I hope to have only one day of server down time — probably Monday of next week — before I start rebuilding the server from the bottom up.

Got ideas, comments, suggestions? Use the comments link or form.