[WEB4LIB] Redirect html->cgi? (Solution?)

James Cayz cayz at lib.de.us
Mon Aug 24 10:59:41 EDT 1998


On Thu, 20 Aug 1998, lydia wrote:
>Has anyone attempted to redirect users from a single html page to a
>single cgi script? Can it be done? (We're running Apache 1.3 on
>Solaris.)
> [. . . ]
>2. Redirect from httpd.conf --
>   ("Redirect /path/moveme.html http://server.foo.edu/moved.cgi")
>   Of course, ScriptAlias is also designed to work with entire
>   directories--so this is essentially the same solution as the symlink.

Lydia & Others,

I know your question well, but your "failed solutions" stumped me, since I
am using the following as the .htaccess file in a specific directory where
I want this to occur:
 - .htaccess - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Options ExecCGI FollowSymLinks
RewriteEngine on
RewriteRule ^foo\.htm$ foo.cgi [T=application/x-httpd-cgi]
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I just tried it again, it still works.  Granted, I am only running
Apache 1.2.5, but I can't see them removing this functionality. Also,
I tried it with the only browser I had handy, lynx, and the back
button worked just fine.  (I started on bar.htm, which linked in HTML
to foo.htm, which gave me foo.cgi, and hitting back took me back to
bar.htm).  Every other file in the directory is unaffected.

It wasn't easy, but there was a recipe for doing exactly this somewhere on
either the main apache site or the ApacheWeek(?) site that is linked off
the Apache site.

If you don't do all three lines, it will fail.  And I'm not sure if
mod_rewrite is compiled in by default, you might need to uncomment out
the appropriate line and re-compile.

I hope this works.

James Cayz

+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
[ James Cayz  #  cayz at lib.de.us #  DelAWARE homepage: http://www.lib.de.us ]
[ Network Processing Administrator #  302-739-4748 x130 # Fax 302-739-6948 ]
[ Delaware Division of Libraries # 43 S. DuPont Hwy / Dover, DE 19901-7430 ]
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+



More information about the Web4lib mailing list