简体   繁体   English

在Apache Web Server的URL末尾获取参数

[英]Get parameters at the end of URL on Apache Web Server

I have a URL with the following syntax: 我有一个使用以下语法的URL:

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

In the /pay directory I have a simple payment form. /pay目录中,我有一个简单的付款表格。 I am using JavaScript to get the URL appendix a1b2c and process it in order to get further data to display in the payment form: 我正在使用JavaScript获取URL附录a1b2c并对其进行处理,以获取进一步的数据以显示在付款表单中:

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

But if I open the URL in the browser, Apache says (of course): 但是,如果我在浏览器中打开URL,Apache会说(当然):

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

How can I solve this problem? 我怎么解决这个问题? Which Apache config do I need? 我需要哪个Apache配置?

I found a solution by asking humbedoo on the Apache Mailing list: 我通过在Apache Mailing列表上询问humbedoo找到了一个解决方案:

You can use AcceptPathInfo in order to get the appendix. 您可以使用AcceptPathInfo来获取附录。

For example, assume the location /test/ points to a directory that contains only the single file here.html. 例如,假设位置/ test /指向仅包含单个文件here.html的目录。 Then requests for /test/here.html/more and /test/nothere.html/more both collect /more as PATH_INFO. 然后,对/test/here.html/more和/test/nothere.html/more的请求都将/ more收集为PATH_INFO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM