Apache 重写:在每个请求路径之前添加 CGI 处理程序?
我有一个托管 Sinatra Web 应用程序的目录。由于一些托管限制,我必须通过 CGI 脚本启动此应用程序;但是,我编写它是为了解析 URL 路径部分,而不仅仅是查询字符串。因此,我的大部分请求都写成:
GET /point/get HTTP/1.0
但是,由于 CGI 脚本的原因,实际调用的 URL 是(例如) http://server.com/script.cgi/point/get。
有没有办法使用 mod_rewrite 将 script.cgi/ 插入到每个传入的请求中?
I have a directory hosting a Sinatra web application. Due to some hosting restrictions, I have to launch this app via a CGI script; however, I've written it to parse out the URL path portion, rather than just the query string. As such, most of my requests are written as:
GET /point/get HTTP/1.0
However, due to the CGI script, the actual URL called is (for example) http://server.com/script.cgi/point/get.
Is there a way, using mod_rewrite, to insert that script.cgi/
into every request that comes in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 .htaccess 中尝试此操作:
这将执行外部重定向。
对于内部重定向,请将最后一行替换为:
Try this in your .htaccess:
This will do external redirect.
For an internal redirect replace last line with this: