【问题标题】:Get parameters at the end of URL on Apache Web Server在 Apache Web Server 上获取 URL 末尾的参数
【发布时间】:2016-02-09 22:34:42
【问题描述】:

我有一个具有以下语法的 URL:

https://www.domain.com/pay/a1b2c

/pay 目录中,我有一个简单的付款表格。我正在使用 JavaScript 获取 URL 附录 a1b2c 并对其进行处理,以便获取更多数据以显示在付款表单中:

var url = window.location.href;
var appendix = url.split("/").pop();
...

但如果我在浏览器中打开 URL,Apache 会说(当然):

Not Found
The requested URL /pay/a1b2c was not found on this server.

我该如何解决这个问题?我需要哪个 Apache 配置?

【问题讨论】:

标签: javascript apache webserver rewrite


【解决方案1】:

我通过在 Apache Mailing list 上询问 humbedoo 找到了解决方案:

您可以使用AcceptPathInfo 来获取附录。

例如,假设位置 /test/ 指向一个目录 仅包含单个文件 here.html。然后请求 /test/here.html/more 和 /test/nothere.html/more 都收集 /more 作为 PATH_INFO。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-12
    • 1970-01-01
    • 1970-01-01
    • 2012-08-22
    相关资源
    最近更新 更多