« Use XSSI to Publish A Weekly Schedule | Main | How to Syndicate RSS Content »

October 29, 2004

Build Your Website with a Plan

Unless you're building your very first website, and it is only a handful of pages, you know what it is like to say "Gee... why didn't I plan for this from the start?"

You can plan for shortcuts when you build the website.

I don't know how many times I've been asked to work on a site that contains a collection of *.htm files and *.html files. Yes, you've heard it doesn't matter -- both extensions are OK. Sure they are... but you just lost a shortcut you could use later by using both, *.htm and *.html file extensions.

Let's look at an example...

Suppose all the webpages on your site have the html extension. A year later you park another domain name on your account, and your hosting account doesn't support multiple names. Luckily for you, you found a script that will do it for you... but it is a CGI script and has to be loaded as soon as someone arrives at your site. The worse part is you have been promoting www.yourdomain.com for a year, and by default most servers are set to look for and load either index.htm or index.html in your root directory.

Cool! Now you have use for an htm file. You can add this to your .htaccess file:
AddType application/x-httpd-cgi .htm

Then when someone clicks on www.yourdomain.com your CGI script will execute.

Of course there may be someone who has bookmarked your homepage as:
www.yourdomain.com/index.html

...and you had to remove the index.html so the index.htm (CGI script) would execute.

You can add another line to your .htaccess file:
ErrorDocument 404 http://yourdomain.com/index1.html

...so that anyone who tries to access your site through the index.html file gets automatically re-directed to the new index file which could be called index1.html

And of course one of my favorites...

If I'm building a large site and have a feeling that the client hasn't planned real well, I'll add this to my .htaccess file:

AddType text/html .html
AddHandler server-parsed .html

This lets me use SSI in html files. This one can be added anytime, but if you build your menu into an included file, and you change it 20-30 files later, you don't have to re-edit all of those files.

Plan for allowing shortcuts when you build the site, and you won't be looking at a lot of work or expense later.

Posted by Steve MacLellan at October 29, 2004 03:22 PM

Comments

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?