Avoiding Index

Aways trying to improve my site, here is how I dropped index.cgi from the URL.

One thing that always bugged me with using scripts is that you tend to see the script name. For example, this site has always had an index.cgi and most PHP sites have index.php in the links. I find it tacky and many commercial sites don’t do this. I don’t want to change my software, so there has to be a way around this problem. The search is on!

Some time ago I figured out how to redirect directly to my script from my main site’s URL. The most obviously method is a little HTML redirect script in your home directory. This is what Web-APP came with, an index.html script with either a meta tag or JavaScript. This allows you to use the base URL to get to the site, but users still see the index.cgi.

If your server supports it, that you can use a service side include (SSI) to redirect to your script name. For example:

<!--#exec cgi=“cgi-bin/index.cgi”-->

This prevents your script name from showing up in on entry; however, it will still show up in all the script links unless you modify your configuration to use your root domain as your script name.

Curiously, I found I could do the same thing without the extra SSI call. If you are using Apache and your host supports .htaccess files, add the following line to it:

DirectoryIndex cgi-bin/index.cgi

This works great and I’ve been able to almost completely eliminate having to see “index” my site’s URL.

Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive