3

I have a vhost in which I would like to rewrite / to something like /cgi-bin/script?123. I thought something like this would work, but this rewrites to "/index.html/ somehow.

RewriteEngine On
RewriteRule ^/$ /cgi-bin/script.cgi?123 [L]

How can you do this?

1 Answer 1

1

Maybe try the following:

RewriteEngine On
RewriteRule ^/?$ /cgi-bin/script.cgi?123 [L]
5
  • Strange. With that, it returns the correct document, but the URL itself isn't rewritten; it stays the same! Nov 17, 2009 at 4:39
  • Hi Jens, So is that what you are looking for? If not, could you give me a couple of examples of input and output you are looking for? Are you trying to redirect the user to a different page or are you trying to define the exact script that gets triggered/loaded when they go to a particular site/url?
    – malonso
    Nov 20, 2009 at 22:27
  • I just want to (silently) redirect "abc.de[/]" to "abc.de/cgi-bin/script.cgi?123" Feb 20, 2010 at 1:00
  • Sorry, I was thinking that you want to keep the URL the same but load a different page. If you want to redirect the user's browser to another page, change "[L]" to "[R=302,L]". I put a 302 redirect in there as an example but you should determine if that is really the correct one to use: en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection.
    – malonso
    Feb 21, 2010 at 22:32
  • Excellent, thanks. There was some problem with reply notifications, sorry for high latency :) Apr 26, 2010 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .