in reply to Need help with redirect

I would suggest not using SSI at all. Instead, create a script in your cgi-bin directory that does the following:

1. Checks for the cookie.
2. If cookie exists, generate "admin output".
3. Else, if cookie does not exist, generate other output.

HTML::Template may be useful here, especially if there is stuff common to both pages.

Your URL will now point to this cgi script directly, rather than to an html file that invokes it via SSI. And you eliminate the redirect as well.

If you really want an HTML file, create a file that contains a frameset with a single frame, and point the source of the frame to the cgi-script.

Alternatively, If you're using Apache, you could also use mod_rewrite to map one URL to another.

Replies are listed 'Best First'.
Re^2: Need help with redirect
by MatthewV (Acolyte) on Jun 02, 2009 at 18:46 UTC
    The reason I wanted to use SSI is because I know no other way of doing this. I am creating a huge admin site to control the content of another site and the only way I could think of doing this is via SSI for the cookie checking. THis is the first time I have ever tried to make a "member's only" type area. I have looked at HTML::Template but I just don't see how it would work in my case. I guess this project is beyond my abilites and I will have to scrap it. I just can't figure out a good way of protecting LOTS of HTML pages behind a login setup.
      Are you using Apache? If so, try googling for htpasswd. This is a way to protect directories of html files using "basic authentication". You'll just need to develop a way of putting approved users (and passwords) into the .htpasswd file.
        I am on an IIS 7 setup. I have looked into ISAPI programs but they are expensive (150$ was the cheepest I could find)