php - Make a page with a parameter same as a page without parameter
问题描述
I am trying to make this page:
https://mediastreet.ie/media-jobs/role-65678
same as this page using htaccess:
https://mediastreet.ie/media-jobs/role
So basically /role-65678 is a parameter like role-{parameter}. So when on /role-65678 i have a script that fetches this (65678) and displays the job according to it.
解决方案
我建议不要编辑您的 htaccess 文件,而是建议使用一个好的旧 get 方法。
使用https://mediastreet.ie/media-jobs/role?id=65678
然后在“role”目录下的index.php文件中,使用如下图的get功能。
<?PHP
$id = $_GET["id"];
//Code to follow
?>
过去的经验告诉我,这将节省很多 htaccess 头痛!
一切顺利。
推荐阅读
- javascript - 如何在 ExtJS 中从父级定义模型关系
- api - 对资源执行过程和执行状态转换有什么区别?
- persistence - 如何在 Open Liberty 中实现 EJBTimer(持久)
- c# - 如何从 url(.NET Core 控制台应用程序)获取完整的 DOM html 源代码?
- java - 使用 PowerMock 使用静态方法 Java 测试最终类时没有代码覆盖
- tensorflow - 在 CNN 训练期间,尽管有损失,但仍能获得持续的训练和验证集准确度?
- java - 如何摆脱主类中令牌“public”的语法错误?
- python - Pandas:在同一个函数调用中将聚合列与非聚合列组合
- mysql - 如何在mysql中获取所有用户及其订单作为子集
- html - 如何使浮动的 div 框响应