【发布时间】: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 配置?
【问题讨论】:
-
看看 apache 提供的重写模块:httpd.apache.org/docs/current/mod/mod_rewrite.html 你会在 SO 和 google 上找到数百万的例子。
-
@arkascha 谢谢你的提示。但是你知道如何实现吗?我仍然对解决方案感到困惑
标签: javascript apache webserver rewrite