我有一个 html 文件,它使用通过查询参数提供的
id
查询 API。
网址看起来像这样:
www.mydomain.com/api-call.html?id=123471
我想在
.htaccess
中指定规则,每个ID都有被重写到另一个路径(不存在)基于id
.
理想情况下,
www.mydomain.com/api-call.html?id=123471
将被重写为 www.mydomain.com/api/call/some-other-text-unrelated-to-id.html
然后,
www.mydomain.com/api-call.html?id=123472
可以重定向到www.mydomain.com/api/call/another-totally-different-filename.html
网络服务器将打印出的唯一网址是
www.mydomain.com/api/call/*
,用户永远不会看到所有带有id
参数的网址。
这可能吗?我用 mod_rewrite 尝试了一些解决方案,但我没有找到解决方案。