Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Maybe try the following:

RewriteEngine On
RewriteRule ^/?$ /cgi-bin/script.cgi?123 [L]
share|improve this answer
    
Strange. With that, it returns the correct document, but the URL itself isn't rewritten; it stays the same! –  Jens Björnhager Nov 17 '09 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 '09 at 22:27
    
I just want to (silently) redirect "abc.de[/]" to "abc.de/cgi-bin/script.cgi?123" –  Jens Björnhager Feb 20 '10 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 '10 at 22:32
    
Excellent, thanks. There was some problem with reply notifications, sorry for high latency :) –  Jens Björnhager Apr 26 '10 at 15:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.