apache mod_rewrite:重写/到cgi脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1719692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:23:25  来源:igfitidea点击:

mod_rewrite: Rewriting / to cgi script

apachemod-rewriteapache2cgivhosts

提问by Jens Bj?rnhager

Is there any way to rewrite a GET /to a cgi script with a parameter? Basically redirect / to /cgi-bin/scipt.cgi?123.

有什么方法可以将GET /重写为带有参数的 cgi 脚本?基本上将 / 重定向到 /cgi-bin/scipt.cgi?123。

This does not work:

这不起作用:

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

Instead it somehow rewrites / to /index.html/

相反,它以某种方式将 / 重写为 /index.html/

Any way of doing this?

有没有办法做到这一点?