in reply to Re^2: Need help with redirect
in thread Need help with redirect

I think what you're trying to do (using a HTTP redirection header with SSI) isn't going to work that way. I don't usually use SSI, but I think the additional magic in the handling of content vs. headers that would be required here simply isn't implemented with most web servers.

Essentially, there are three ways to redirect:

You could try method 2, though, if you really need to embed the script's output into some HTML page via SSI.  Using <meta http-equiv="refresh" ...>, the redirect instruction becomes part of the HTML page, which you've already begun outputting, when the SSI instruction is being encountered.

Replies are listed 'Best First'.
Re^4: Need help with redirect
by ikegami (Patriarch) on Jun 02, 2009 at 02:03 UTC

    To use method two, he'd have to move the SSI below the TITLE element.

    <!DOCTYPE html ...> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>...</title> <!--#exec cgi="/ssi/checkcookie.pl"--> ... </head> ... </html>
Re^4: Need help with redirect
by MatthewV (Acolyte) on Jun 02, 2009 at 02:04 UTC
    a meta refresh would not work. I am using the SSI to protect certain pages. This is the first time I have tried to password protect a member's section of my site. Using a meta refresh can be easly bypassedby hitting the escape key fast enough. Using the SSI as the frisst thing called should allow the redirect to happen before the protected content is loaded.
      a meta refresh would not work.

      You'd have to send out the real content only in case the cookie is ok. Otherwise, redirect. If the users stop the redirect, they'll just get nothing... no content and no login page.

      Using the SSI as the first thing called should allow the redirect to happen before the protected content is loaded.

      As I said, I'm no SSI expert, but some quick googling seems to confirm my understanding (that it shouldn't).  But maybe someone else knows the trick to make it work...