Begin forwarded message:
B McKee wrote:
Yeah, ok, this isn't completely on topic. Please humour me (or at least
flame me politely). I need to redirect people to a perl-CGI script....
I have written a perl script that generates a series of active web
pages. It's in the cgi-bin and works fine when accessed directly eg:
http://www.example.com/cgi-bin/index.pl
So, now I want to redirect anyone going to http://www.example.com to the above link instead.
I thought simply putting Redirect permanent index.* /cgi-bin/index.pl
in a .htaccess file would work - but it doesn't seem to do anything.
Googling about seems to say it should work.
My ISP does allow .htaccess files as I'm using them elsewhere for auth
purposes.
What am I doing wrong? Or what should I be doing instead?
Input appreciated.
It appears that the second portion of the Redirect must be an absolute link, and I don't know that the first can be a regex/glob constuct... for that you appear to need RedirectMatch.
http://httpd.apache..org/docs/mod/mod_alias.html#redirect
Alternatively,
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/$ /cgi-bin/index [R,L]
</IfModule>
From: WC -Sx- Jones <[EMAIL PROTECTED]>
[ without mod_rewrite ]
Redirect permanent / http://www.example.com/cgi-bin/index.pl


But mod_rewrite would be best - as the OP stated...
Also, you may want to create a simple
index.html file or a plain index.cgi in
DocuementRoot to either
HTTP-EQUIV=Refresh content=0;URL=blah blah
Or inside the index.cgi simply print-out
Location: http://www.example.com/cgi-bin/index.pl\n\n
Wiggins d'Anconia wrote:

   <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule     ^/$ /cgi-bin/index [R,L]
    </IfModule>
This is also possible:
RedirectMatch permanent /(.*) http://www.example.com/cgi-bin/index.pl
(It's just another way...)
I would always use mod_rewrite myself...


Why not just move your /cgibin/index.cgi  to be your index.cgi?
You can tell Apache to use index.cgi as the default page
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.php
</IfModule>


That would make the index.cgi a directory index which means it would be
printed as is rather than executed.  You would also need to turn on
ExecCGI and add a handler for .cgi....
At least that is my understanding....


Thanks all for the various suggestions. I tried most of them :-)
None of them worked. It turns out all of them were 'foiled' by the settings
used by my ISP. Executables only in the cgi-bin and no directives in .htaccess
files I gather.


So, I did what I probably should have done in the first place and called them.
They went ahead and did something (they were fuzzy but I suspect it was mod_rewrite)
and I'm a happy camper.


I have saved your instructions for future use on my own web-server.

Thanks again
Brian


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to