Search Engine Optimization > Webmaster World > cgi with tcl file extension
cgi with tcl file extension
Posted by John Douglas on October 31st, 2005


I have some tcl scripts to dynamically generate html. The only way I
know for a user to get to those pages is by entering the URL that
includes the .tcl extension. (The .htaccess file in my root directory
on the server has been modified to allow .tcl scripts to be recognized
and executed properly.)

Is it possible to make these files accessible giving them an .htm or
..html extension?

Thanks,
JD

Posted by Mark Goodge on October 31st, 2005

On 31 Oct 2005 10:59:22 -0800, John Douglas put finger to keyboard and
typed:

There are several ways of doing it. The simplest is to use your
..htacess settings to make .html and .htm files executable as TCL
scripts. But then you'd need to convert all your existing HTML files
into TCL, as otherwise they won't work. Having a mixture of plain HTML
files and TCL files, all with the same extension, is rather more
complicated (although doable, if necessary).

It might be easier to answer your question if you told us what you
want to acheive by making such a change. That way, it's possible to
advise on the best way of doing it, or even to offer an alternative
approach which will give the same result. What's the problem, in your
situation, with simply linking to the files with a .tcl extension?

Mark
--
http://www.OrangeHedgehog.com - RSS feeds and Google Adsense tools
"A sky isn't always blue, a sun doesn't always shine. It's
alright to fall apart sometimes"

Posted by John Douglas on November 1st, 2005


Mark Goodge wrote:
I definitely want to keep a mixture of plain html and tcl scripts.

I have two main purposes, one of which I suppose is a bit dubious.

1. The file www.domain.com/folder1/index.html is auto loaded whenever a
user puts in "domain.com/folder1" as the URL. I want index.html to be
generated via a tcl script.

2. Obviously many of the links can be kept as .tcl extensions. But in
some cases, I simply want the user to put in an html extension rather
than tcl since its more common and easier to recall. Not a strong
argument, but a convenient luxury.

Thanks,
JD


Posted by Mark Goodge on November 1st, 2005

On 1 Nov 2005 10:04:41 -0800, John Douglas put finger to keyboard and
typed:

Why not just make index.tcl a valid default page? If you can use
..htaccess to make .tcl files executable, then you almost certainly
have the ability to make that change as well. The line to put in
..htaccess is:

DirectoryIndex index.html index.htm index.tcl

This will look, in order, for the three different filenames and load
whichever of them it finds first. If that doesn't work, then ask your
hosting provider to enable it - again, if they're happy to allow you
to run TCL on the server, that shouldn't be a problem.

Personally, I don't think that expecting users to remember or type any
URL that ends in a filename is realistic. If you need to give out URLs
in a way that requires people to enter them manually, rather than
following a link or a bookmark, then place them inside a directory so
that you can point them to domain.com/name rather than
domain.com/name.ext - if your default page within the /name directory
is index.tcl (made a valid default by the method above), then it will
work perfectly.

However, if you simply must have a .htm or .html filename, then the
simplest solution is to switch XBitHack on, and then make the .htm
file include the .tcl file via SSI. Take a look at the Apache
documentation at http://httpd.apache.org/docs/1.3/mod/mod_include.html
for instructions on how to do this - it's fairly straightforward.

Another option is to use Apache's built-in URL rewriting so that if
someone types in, say, file.htm when the real file is file.tcl then
the server automatically rewrites that to file.tcl for them. I'm not
going to give you the recipe for that as URL rewriting is quite a
complex thing and you need to understand what's happening when you do
it rather than just following a preset pattern, but it's not too
difficult to learn and very powerful.

Mark
--
http://www.OrangeHedgehog.com - RSS feeds and Google Adsense tools
"Would you save my soul, tonight?"

Posted by John Douglas on November 2nd, 2005

Thanks for your help. I suppose you are right in that I need not mess
with changing the extension.

Posted by Toby Inkster on November 2nd, 2005

John Douglas wrote:

Try enabling MultiViews and renaming the files "blah.html.tcl" then
visiting "blah.html" (leaving the ".tcl" off the URL).

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


Funbolt.com - Entertainment portal, wallpapers, sexy celebs